View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
OssieMac OssieMac is offline
external usenet poster
 
Posts: 2,510
Default Delete data Help!!

Hi Yossy,

I have now answered you other post. sorry it took so long but I have been at
work. Here it is again. See your other post for explanation.

Sub Clearcontent()
Dim targetcol As String
Dim sh As Worksheet
Dim myrow As Long
Dim lastrowtodelete As Long

Dim objCellToFind As Object

targetcol = "A"
For Each sh In ActiveWorkbook.Sheets
'If ActiveSheet.Name < sh.Name Then

With sh
Set objCellToFind = .Columns(targetcol). _
Find(What:="*Tile in month for the Period*", _
after:=Cells(1, 1), LookIn:=xlValues, LookAt:=xlWhole, _
SearchOrder:=xlByRows, SearchDirection:=xlNext)

If objCellToFind Is Nothing Then
'*Tile in month for the Period* not found
'so bypass code down to Next.
GoTo myLabel
Else
myrow = objCellToFind.Row + 1
End If

If Left(Trim(.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

myLabel:
Next
End Sub


--
Regards,

OssieMac