Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21238

Delete rows/multiple sheets

$
0
0
Hello,

could you help me to finish my code please?
I would like to delete all the rows except the header in multiple sheets. Somehow this code does not work
It is added to a button, which should delete all the data from the 5th row in the first 4 Sheets and then delete the data on the other ones from the 2nd row down.
Can somebody help me please?
Thanks a lot

Code:

Sub Clean_Report()

Dim element As Variant
Dim i, found As Integer
Dim country As String

Application.StatusBar = "Progress 25 %"

'this is to delete the data on the first 4 Sheets from the 5th row down
Sheets("Report").Select

If ActiveSheet.AutoFilterMode = True Then ActiveSheet.AutoFilterMode = False
Rows("4:4").Select
Selection.AutoFilter

'this is to delete the data from the 2nd row down on all the other sheets
Sheets(Array("Sheet1", "Sheet2", "Sheet2")).Select
Rows(1).Offset(1, 0).Resize(Rows.Count - 1).ClearContents


Application.StatusBar = "Progress 35 %"

End Sub


Viewing all articles
Browse latest Browse all 21238

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>