PC Review


Reply
Thread Tools Rate Thread

Clear entire rows below last row of data in col A except in 1st 3 sheets

 
 
Max
Guest
Posts: n/a
 
      7th Jan 2008
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.


 
Reply With Quote
 
 
 
 
Rick Rothstein \(MVP - VB\)
Guest
Posts: n/a
 
      7th Jan 2008
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.
>


 
Reply With Quote
 
RichardSchollar
Guest
Posts: n/a
 
      7th Jan 2008
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" <demecha...@yahoo.com> 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.


 
Reply With Quote
 
Nigel
Guest
Posts: n/a
 
      7th Jan 2008
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
(E-Mail Removed)



"Max" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.
>


 
Reply With Quote
 
Max
Guest
Posts: n/a
 
      7th Jan 2008
Marvellous, Rick. Thanks. Runs great.


 
Reply With Quote
 
Max
Guest
Posts: n/a
 
      7th Jan 2008
Great, Richard. Thanks. Your sub runs well, too!


 
Reply With Quote
 
Max
Guest
Posts: n/a
 
      7th Jan 2008
Thanks, Nigel. Tried your sub. It runs well, too.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to clear rows before copying data steve1040 Microsoft Excel Programming 1 17th Apr 2009 04:58 AM
Clear data and hide rows. SANTANDER Microsoft Excel Programming 7 20th Mar 2008 09:52 AM
Clear rows with no data? =?Utf-8?B?S2FpIEN1bm5pbmdoYW0=?= Microsoft Excel Programming 4 2nd Jul 2007 10:44 PM
Help to clear data & delete rows =?Utf-8?B?RWRkeSBTdGFu?= Microsoft Excel Programming 1 11th Mar 2006 10:29 AM
External Data - Insert Entire Rows Mark Emerson Microsoft Excel Worksheet Functions 0 24th Aug 2004 08:38 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:31 PM.