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

M

Max

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.
 
R

Rick Rothstein \(MVP - VB\)

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
 
R

RichardSchollar

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
 
N

Nigel

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top