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 Deletion of Data across multiple sheet

Please I wouldn't know why this code is not working. I want to delete all
contents below "Tile in month for the Period" in Column A across multiple
sheets in my workbook. I get error. I want it to ignore "see attached file"
i.e should not clear the content where it sees "see attached file".

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

All help totally appreciated. Thanks a big bunch.



 
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
Help with deletion of Data in Multiple Sheets Yossy Excel Programming 3 October 25th 08 11:38 AM
Help with deletion of Data in multiple Yossy Excel Programming 1 October 24th 08 01:41 PM
How do I link cells, sheet to sheet, to recognize row deletion Max Excel Programming 5 February 27th 06 10:27 PM
Prevent Sheet Deletion T-®ex[_60_] Excel Programming 7 September 7th 05 05:17 AM
Sheet deletion mitch Excel Discussion (Misc queries) 4 August 19th 05 12:10 AM


All times are GMT +1. The time now is 05:29 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"