Delete data Help!!
can anyone help me include the skip code or make the code work while it
ignore those sheets where it does not find the string (Tile in month for the
Period), All help appreciated.
Sub Clearcontent()
Dim targetcol As String
Dim sh As Worksheet
Dim myrow As Long
Dim lastrowtodelete As Long
targetcol = "A"
For Each sh In ActiveWorkbook.Sheets
'If ActiveSheet.Name < sh.Name Then
With sh
myrow = .Columns(targetcol).Find(What:="*Tile in month for the Period*", _
after:=Cells(1, 1), LookIn:=xlValues, LookAt:=xlWhole, _
SearchOrder:=xlByRows, SearchDirection:=xlNext).Row + 1
If Application.Trim(Left(.Cells(myrow, 1), 3)) _
= "See" Then myrow = myrow + 1
lastrowtodelete = .Cells(myrow, targetcol).End(xlDown).Row
..Range(.Cells(myrow, targetcol), .Cells(lastrowtodelete,
targetcol)).ClearContents
End With
'End If
Next
End Sub
Thanks a big bunch. I really appreciate it.
|