LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 127
Default 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.
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
If data is returned then delete data LiveUser Excel Worksheet Functions 1 November 14th 07 12:22 AM
Delete duplicate data based on date of data Phillip[_5_] Excel Programming 1 January 24th 07 05:55 PM
Using autofilter to ADD data not delete data jim_0068[_7_] Excel Programming 1 May 9th 06 03:49 PM
Delete every 3rd row, then delete rows 2-7, move info f/every 2nd row up one to the end and delete the row below Annette[_4_] Excel Programming 2 September 21st 04 02:40 PM


All times are GMT +1. The time now is 08:03 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"