Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 127
Default Help with deletion of Data in Multiple Sheets

I have about 50 sheets in a Workbook. Every time I have to manually delete
certain data from all sheets. I want to delete all data below "Total Number
of Records"

E.g
Total Number of REcords
My Name is PP
Your name is LL
Today's Date..
Total No of Days

Please note that there could be more than four rows of data below "Total
Number of Record". Preferably it should look through all rows e.g.(A20) of
data below the title and delete all. If there is a break space in the rows it
should stop (Cos some data might be below the empty row) and they do not need
to be deleted.

Can you please help me... All help totally appreciated.

Thanks a Great deal
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Help with deletion of Data in Multiple Sheets

Hi

I loop through column A and delete entire rows below "Total Number of
Records" and down to first empty row. Continue with next sheet.

Try this:

Sub DeleteData()
TargetCol = "A"
For Each sh In ThisWorkbook.Sheets
If ActiveSheet.Name < sh.Name Then
Sheets(sh.Name).Select
End If
Set f = Columns(TargetCol).Find(What:="Total Number of Records")
fRow = f.Row
LastRowToDelete = Cells(fRow, TargetCol).End(xlDown).Row
Range(Rows(fRow + 1), Rows(LastRowToDelete)).Delete
Next
End Sub

Regards,
Per

On 24 Okt., 04:15, Yossy wrote:
I have about 50 sheets in a Workbook. Every time I have to manually delete
certain data from all sheets. I want to delete all data below "Total Number
of Records"

E.g
Total Number of REcords
My Name is PP
Your name is LL
Today's Date..
Total No of Days

Please note that there could be more than four rows of data below "Total
Number of Record". Preferably it should look through all rows e.g.(A20) of
data below the title and delete all. If there is a break space in the rows it
should stop (Cos some data might be below the empty row) and they do not need
to be deleted.

Can you please help me... All help totally appreciated.

Thanks a Great deal


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 127
Default Help with deletion of Data in Multiple Sheets

please i get error "Compilation code" and it highlighted the " Sub
DeleteData()".

Thanks for helping.

"Per Jessen" wrote:

Hi

I loop through column A and delete entire rows below "Total Number of
Records" and down to first empty row. Continue with next sheet.

Try this:

Sub DeleteData()
TargetCol = "A"
For Each sh In ThisWorkbook.Sheets
If ActiveSheet.Name < sh.Name Then
Sheets(sh.Name).Select
End If
Set f = Columns(TargetCol).Find(What:="Total Number of Records")
fRow = f.Row
LastRowToDelete = Cells(fRow, TargetCol).End(xlDown).Row
Range(Rows(fRow + 1), Rows(LastRowToDelete)).Delete
Next
End Sub

Regards,
Per

On 24 Okt., 04:15, Yossy wrote:
I have about 50 sheets in a Workbook. Every time I have to manually delete
certain data from all sheets. I want to delete all data below "Total Number
of Records"

E.g
Total Number of REcords
My Name is PP
Your name is LL
Today's Date..
Total No of Days

Please note that there could be more than four rows of data below "Total
Number of Record". Preferably it should look through all rows e.g.(A20) of
data below the title and delete all. If there is a break space in the rows it
should stop (Cos some data might be below the empty row) and they do not need
to be deleted.

Can you please help me... All help totally appreciated.

Thanks a Great deal



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Help with deletion of Data in Multiple Sheets

Just a guess, did you copied the entire code including the "End Sub"
line.

Regards,
Per

On 24 Okt., 15:39, Yossy wrote:
please i get error "Compilation code" and it highlighted the " Sub
DeleteData()".

Thanks for helping.



"Per Jessen" wrote:
Hi


I loop through column A and delete entire rows below "Total Number of
Records" and down to first empty row. Continue with next sheet.


Try this:


Sub DeleteData()
TargetCol = "A"
For Each sh In ThisWorkbook.Sheets
* * If ActiveSheet.Name < sh.Name Then
* * * * Sheets(sh.Name).Select
* * End If
* * Set f = Columns(TargetCol).Find(What:="Total Number of Records")
* * fRow = f.Row
* * LastRowToDelete = Cells(fRow, TargetCol).End(xlDown).Row
* * Range(Rows(fRow + 1), Rows(LastRowToDelete)).Delete
Next
End Sub


Regards,
Per


On 24 Okt., 04:15, Yossy wrote:
I have about 50 sheets in a Workbook. Every time I have to manually delete
certain data from all sheets. I want to delete all data below "Total Number
of Records"


E.g
Total Number of REcords
My Name is PP
Your name is LL
Today's Date..
Total No of Days


Please note that there could be more than four rows of data below "Total
Number of Record". Preferably it should look through all rows e.g.(A20) of
data below the title and delete all. If there is a break space in the rows it
should stop (Cos some data might be below the empty row) and they do not need
to be deleted.


Can you please help me... All help totally appreciated.


Thanks a Great deal- Skjul tekst i anførselstegn -


- Vis tekst i anførselstegn -


Reply
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 Yossy Excel Programming 1 October 24th 08 01:41 PM
Automatic deletion of specific cells from multiple sheets Jman Excel Worksheet Functions 4 June 12th 07 03:44 PM
Multiple Sheets (Need to create 500 individual sheets in one workbook, pulling DATA Amaxwell Excel Worksheet Functions 4 August 17th 06 06:23 AM
Deletion of rows where a value is satisfied for all the sheets Rashid Khan Excel Programming 2 March 26th 05 05:03 AM
how do i undo deletion of sheets Krishnan Seshadri Excel Worksheet Functions 1 March 18th 05 04:47 PM


All times are GMT +1. The time now is 02:32 AM.

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

About Us

"It's about Microsoft Excel"