Label each row in a table in sequence

Tcurtis

Board Regular
Joined
Aug 15, 2009
Messages
149
Good morning. I am looking for some VBA that would label each row in a table in sequence from 1 to 10. I am counting the number of times a model number comes up during the year. I have them in order of largest to smallest by top 10. I now need to label each row from 1 thru 10. Autonumber will not work because it starts over from the last highest number. How can I have my table or query number each row after I run an update on the data?
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
You need 2 tables.....
1. the target table you already have,tTarget.
2. An empty version of the target table, with auto num ready to start at 1, TTarget_MT

create the tTarget_MT:
copy the structure of tTarget, empty the table, then compact the db.

then in the macro to create the data,
step 1, copyObject tTarget_MT to tTarget.
step 2, run append query.

The empty table (MT) will always start at 1 since it never gets written in.
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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