I want to be able to loop thru an excel workbook that has 20 sheets init and be able to delete the first row in each sheet.
Here is the code I have. it deletes all the rows(the first sheet only has 2 rows)in the first sheet.
Thanks
Here is the code I have. it deletes all the rows(the first sheet only has 2 rows)in the first sheet.
Thanks
Code:
Set xlapp = GetObject(, "Excel.Application")
xlapp.Visible = False
Set xlwb = xlapp.Workbooks.Open("N:\ESE Development\PA E & S\Program\sheets\es_test.xls")
Set sheet = xlapp.ActiveWorkbook.Sheets(1)
z = 1
sheetcnt = xlapp.ActiveWorkbook.Sheets.Count
For z = 1 To sheetcnt
Set sheet = xlapp.ActiveWorkbook.Sheets(z)
MsgBox sheet.Name & " ::::" & z
Rows(1).EntireRow.Delete
Next z