Sequential numbers

neilp

Well-known Member
Joined
Jul 5, 2004
Messages
529
Office Version
  1. 365
Platform
  1. Windows
Hi

Got a spreadsheet whereby row one contains important info:
B1 is a constant code (501107), D1 is a constant code (171205) and F1 is a number starting at 0001. H1 contains a number that i type in.

What needs to happen with this spreadsheet is, A2 needs to have B1&D1&F1 and it needs to carry on down column A until it has repeated by the number of times in H1.
eg A2 would be 501107171205001, A3 would be 501107171205002 etc. Happy for it to work in VBA if that is easier, but I am a bit stumped.

Any Ideas?

Thanks in advance

Neil
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Hi, something like this, copied down as far as may be required.


Excel 2013/2016
ABCDEFGH
1501107171205110
2501107171205001
3501107171205002
4501107171205003
5501107171205004
6501107171205005
7501107171205006
8501107171205007
9501107171205008
10501107171205009
11501107171205010
Audit Sheet
Cell Formulas
RangeFormula
A2=IF(ROWS($A$2:A2)>$H$1,"",$B$1&$D$1&TEXT($F$1+ROWS($A$2:A2)-1,"000"))
 
Upvote 0
Thanks FormR. certainly works. The file will get uploaded to another system, so it might kick it out for having formulas in cells that aren't being used.

Will post again if that is a problem and then I'd have to look at the VBA option.

Thanks for your help

Neil
 
Upvote 0
it might kick it out for having formulas in cells that aren't being used.

You could try something like this to only populate the required cells with the formula.

Code:
Sub m()
Range("A2").Resize(Range("H1").Value).Formula = "=$B$1&$D$1&TEXT($F$1+ROWS($A$2:A2)-1,""000"")"
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,310
Members
452,634
Latest member
cpostell

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