Question : Remove rows and content

I need Experts help to write a script which is able to delete row between line 12 to “Total Hours” row and clear all content between Line 7 to “Total Hours” row. Hope Experts will help me to write this script. Attached is the workbook for Experts perusal.


Attachments:
 
 

Answer : Remove rows and content

Oops, sorry, instead of Clear, you should put ClearContents, could have seen it from your question.

Sub DeleteRows()
Dim lr, i As Long
Dim ws As Worksheet
Set ws = ThisWorkbook.Worksheets("TaskTracker")
lr = ws.Range("A65536").End(xlUp).Row
For i = lr - 1 To 12 Step -1
    ws.Cells(i, 1).EntireRow.Delete
Next i
For i = 11 To 7 Step -1
    ws.Cells(i, 1).EntireRow.ClearContents
Next i
End Sub
Random Solutions  
 
programming4us programming4us