LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Adding counter to new worksheet

I am adding a record number into column A of a data matrix, and the
number of rows in the matrix varies. I have the following code to do
this:

With Worksheets("WorksheetName")
For i = 2 To .Range("B65536").End(xlUp).Row
Cells(i, 1).Value = i - 1
Next i
End With

My problem is the the macro just added the worksheet where the data
exists, so I don't know it's name. Since this macro is iterative and
creates several such sheets the worksheet name keeps changing. How
do I make this macro work when the worksheet name is different every
time?

Thanks for the help.

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding Counter to column for number of identical file numbers Sam Excel Discussion (Misc queries) 1 September 16th 08 06:48 PM
Adding a counter to ranges wmureports Excel Programming 2 June 29th 06 06:40 PM
Counter in a worksheet Jason B Excel Worksheet Functions 3 January 26th 06 07:00 PM
Adding a counter to a User Form in Excel Pam Excel Programming 2 August 17th 04 02:55 PM
Linked worksheet Query Counter Ed Lisay Excel Programming 1 September 14th 03 08:43 PM


All times are GMT +1. The time now is 10:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"