Help with changing code for numbering

scottsoo9

New Member
Joined
May 26, 2010
Messages
15
This is my code for numbering in order each of my 500 worksheets from 1 to 500 in order. (Tab 1 gets 1 in cell A1, Tab 2 gets 2 in cell A1........)

Sub TabNumInCellA1()
Dim ShtNum As Double

For ShtNum = 1 To Worksheets.Count
Worksheets(ShtNum).Range("A1") = ShtNum
Next ShtNum

End Sub

How do I change the code to make my number start at a different number besides 1? Example: Tab 1 gets 501 in cell A1, Tab 2 gets 502 in cell A2)

Any help would be appreciated.
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Try

Rich (BB code):
Sub TabNumInCellA1()
Dim ShtNum As Double

For ShtNum = 1 To Worksheets.Count
    Worksheets(ShtNum).Range("A1") = ShtNum + 500
Next ShtNum

End Sub
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,719
Members
452,939
Latest member
WCrawford

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top