KIMco
KIMco

Reputation: 23

Macro to delete the first rows in all existing sheets in Excel

I have an excel file with around 300 sheets for which I need to remove the first rows. Could you please suggest VBA code for doing this?

Thanks in advance!

Upvotes: 0

Views: 19661

Answers (2)

silentsurfer
silentsurfer

Reputation: 2438

Private Sub deleteRows()

    Dim ws As Worksheet

    For Each ws In ThisWorkbook.Sheets
        ws.Range("A1").EntireRow.Delete
    Next ws

End Sub

Upvotes: 1

Sathish Kothandam
Sathish Kothandam

Reputation: 1520

Atleast try to post what you have tried.

below code will delete 1st in all sheets in active workbook

Sub LoopThroughSheets()
    Dim ws As Worksheet
    For Each ws In ActiveWorkbook.Worksheets

     ws.Range("1:1").Delete

    Next ws
End Sub

Upvotes: 6

Related Questions