I need to delete the first 3 rows of every worksheet in the current workbook. Could someone give me the code to do this in a module?
I need to delete the first 3 rows of every worksheet in the current workbook. Could someone give me the code to do this in a module?
[VBA]
Sub DeleteFirstThreeRows()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
ws.Range("1:3").Delete
Next
End Sub
[/VBA]
- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com
_______
Hi Ssinghal
Welcome to VBAX
I've retitled your question title to make it more meaningful for searches. If your question is solved, you can mark it so using the Thread Tools dropdown.
Regards
MD
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'
You can also do this manually for all sheets needed by:
Holding down CTRL and selecting all the sheets by clicking them (or by clicking the left most and then finding the right most and clicking to select all sheets, or by right clicking any sheet tab and choosing Select All Sheets.
Once selected, you can rows 1 to 3 in any column on the sheet you are on, right click>delete entire row and <poof> they are gone.
If you have posted the same question at multiple forums, please read this IMPORTANT INFO.
Please use the thread tools to mark your thread Solved
Please review the Knowledge Base
for samples and solutions , or to submit your own!