Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Clear entire rows below last row of data in col A except in 1st 3 sheets

I've got a file with 3 sheets placed leftmost (no action to be taken), then
in all the rest of the sheets to the right of the 3 leftmost sheets (a total
of 50+ sheets is to the right) I need to clear entire rows below the last
row of data in col A (within each sheet). Thanks.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,202
Default Clear entire rows below last row of data in col A except in 1st 3 sheets

I'm thinking something like this should work...

Sub PartialClear()
Dim X As Long
Dim LastRow As Long
Dim CurrentSheet As Worksheet
Set CurrentSheet = ActiveSheet
On Error Resume Next
Application.ScreenUpdating = False
For X = 4 To Worksheets.Count
With Worksheets(X)
.Activate
.Range(.Cells(Rows.Count, 1).End(xlUp), _
.Cells(Rows.Count, Columns.Count)).Clear
End With
Next
Application.ScreenUpdating = True
CurrentSheet.Activate
End Sub

Rick


"Max" wrote in message
...
I've got a file with 3 sheets placed leftmost (no action to be taken),
then in all the rest of the sheets to the right of the 3 leftmost sheets
(a total of 50+ sheets is to the right) I need to clear entire rows below
the last row of data in col A (within each sheet). Thanks.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 76
Default Clear entire rows below last row of data in col A except in 1st 3sheets

Hi Max

Give this a try:

Sub Test()
Dim i As Long
On Error Resume Next
For i = 4 To Sheets.Count
With Sheets(i)
.Range(.Cells(Rows.Count, Columns.Count), .Cells(Rows.Count,
1).End(xlUp).Offset(1, 0)).Clear
End With
Next
End Sub

Richard




On 7 Jan, 07:42, "Max" wrote:
I've got a file with 3 sheets placed leftmost (no action to be taken), then
in all the rest of the sheets to the right of the 3 leftmost sheets (a total
of 50+ sheets is to the right) I need to clear entire rows below the last
row of data in col A (within each sheet). Thanks.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 735
Default Clear entire rows below last row of data in col A except in 1st 3 sheets

Sub cleardown()
Dim xS As Integer
For xS = 4 To Worksheets.Count
With Worksheets(xS)
.Range(.Cells(.Cells(.Rows.Count, 1).End(xlUp).Row + 1, 1), _
.Cells(.Rows.Count, .Columns.Count)).ClearContents
End With
Next
End Sub

--

Regards,
Nigel




"Max" wrote in message
...
I've got a file with 3 sheets placed leftmost (no action to be taken),
then in all the rest of the sheets to the right of the 3 leftmost sheets
(a total of 50+ sheets is to the right) I need to clear entire rows below
the last row of data in col A (within each sheet). Thanks.


  #5   Report Post  
Posted to microsoft.public.excel.programming
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Clear entire rows below last row of data in col A except in 1st 3 sheets

Marvellous, Rick. Thanks. Runs great.




  #6   Report Post  
Posted to microsoft.public.excel.programming
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Clear entire rows below last row of data in col A except in 1st 3 sheets

Great, Richard. Thanks. Your sub runs well, too!


  #7   Report Post  
Posted to microsoft.public.excel.programming
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Clear entire rows below last row of data in col A except in 1st 3 sheets

Thanks, Nigel. Tried your sub. It runs well, too.


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
Clear rows with no data? Kai Cunningham[_2_] Excel Programming 4 July 2nd 07 10:44 PM
Comparing data between sheets, and copying rows with data Fleone Excel Programming 1 June 2nd 06 06:54 PM
Help to clear data & delete rows Eddy Stan Excel Programming 1 March 11th 06 10:29 AM
Can excel sort entire rows of data like access? Jack Excel Worksheet Functions 1 September 13th 05 06:17 PM
Clear contents of unprotected cells in entire workbook with a macr FinnGirl Excel Programming 1 June 29th 05 05:32 PM


All times are GMT +1. The time now is 02:44 PM.

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"