Hi,
does anyone have an excel macro which can remove headers (first rows) in a multiple sheet spreadsheet?
I'd appreciate it very much if you could pass it on. Even if it is a macro that does something similar.
thanks for your assistance.
cheers
Hi,
does anyone have an excel macro which can remove headers (first rows) in a multiple sheet spreadsheet?
I'd appreciate it very much if you could pass it on. Even if it is a macro that does something similar.
thanks for your assistance.
cheers
u can try some thing like this
Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Select
Sheets("Sheet1").Activate
Range("A1").Select
Selection.EntireRow.Delete
Hi, thanks for the help but, i get the msg below when i run it.
"invalid outside procedure".
do check with the sheets names...
else
create a new module
Sub del()
Worksheets(Array("Sheet1", "Sheet2", "Sheet3")).Select
Sheets("Sheet1").Activate
'Cells.Select
Selection.ClearContents
End Sub
[VBA]Option Explicit
Sub ClearHeaders()
Dim sh As Worksheet
For Each sh In Sheets
sh.Rows(1).ClearContents
Next
End Sub
[/VBA]
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
ok, we are making progress!
but on the line of code in bold, how can i include the other sheets?
it did work on the "Unreleased" one but the others still have the header.
it must be something very simple...
Sub del()
Sheets(Array("Unreleased", "Pending Inspection", "Inspected - Skipped", "Inspected - Complete")).Select
Sheets("Unreleased").Activate
Range("A1").Select
Selection.EntireRow.Delete
End Sub
thanks for your help!
I would only use the array method if it applies to specific sheets, not all sheets., otherwise see post 5
[vba]Sub del()
Sheets(Array("Unreleased", "Pending Inspection", "Inspected - Skipped", "Inspected - Complete")).Select
Rows(1).Select
Selection.ClearContents
Sheets(1).Select
Range("A1").Select
End Sub
[/vba]
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
small advice
insted of
Selection.EntireRow.Deleteuse this
Selection.ClearContents
As its in arrry it will clear header in respected sheet ,but u neeed to mention sheet anemas correctly
Hi all,
thanks for the help.
i got it to work.
thanks mdmackillop vbmenu_register("postmenu_157236", true);
i used post #5 which is what i was looking for.
Shamsam1 thanks for the help, i will keep this array idea for another macro i also need.
thank you
do mark ur thread as solved......