I want to manipulate some data on all worksheets in a particular workbook except the last 6 sheets. The number of worksheets will not be constant. Could someone help with the code to do this? Thanks.
I want to manipulate some data on all worksheets in a particular workbook except the last 6 sheets. The number of worksheets will not be constant. Could someone help with the code to do this? Thanks.
Hi,
Use something like that:Originally Posted by ssinghal
For Xi=1 to Worksheets.Count - 6 'your code here for Sheets(Xi) Next Xi
One Hundred MS Excel Games
[vba]For i = 1 To Sheets.Count - 6
Sheets(i).Range("A1")=2
Next
[/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'
How do I make it go to the next worksheet? It is performing my action on the first sheet everytime.
My code should enter a value on each sheet except the last six. Can you post your code?
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'
I figured it out. I needed Sheet(i).Select in my code.
Thanks.