ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   help with macro about data entry with double counter (https://www.excelbanter.com/excel-programming/359912-help-macro-about-data-entry-double-counter.html)

[email protected]

help with macro about data entry with double counter
 
Hi all,

I want to enter data in a new spreadsheet in the following manner:

The first entry will be NF06046V01. The counter after the "V" will go
up to 5. Then the counter 046 will be 047, and the counter after the
"V" for this counter will start from "01" and go to "V05". Then we will
go to raise the first counter by one again. until that first counter
reaches to 300.

i.e.The first 11 entries will be
NF06046v01
NF06046v02
NF06046v03
NF06046v04
NF06046v05
NF06047v01
NF06047v02
NF06047v03
NF06047v04
NF06047v05
NF06048v01
....
Thanks for any help.


mudraker[_376_]

help with macro about data entry with double counter
 

do you want this as a formula or a macro


--
mudraker
------------------------------------------------------------------------
mudraker's Profile: http://www.excelforum.com/member.php...fo&userid=2473
View this thread: http://www.excelforum.com/showthread...hreadid=536698


Nigel

help with macro about data entry with double counter
 
Select the sheet you wish to add the sequence and run the macro below
........

Sub LoadData()
Dim xFirst As Integer, xSecond As Integer, xRow As Long

xRow = 1 ' first row to start the sequence

With ActiveSheet
For xFirst = 46 To 300
For xSecond = 1 To 5
If xFirst < 100 Then
.Cells(xRow, 1) = "NF060" & CStr(xFirst) & "v" & CStr(xSecond)
Else
.Cells(xRow, 1) = "NF06" & CStr(xFirst) & "v" & CStr(xSecond)
End If
xRow = xRow + 1
Next xSecond
Next xFirst
End With
End Sub


--
Cheers
Nigel



wrote in message
oups.com...
Hi all,

I want to enter data in a new spreadsheet in the following manner:

The first entry will be NF06046V01. The counter after the "V" will go
up to 5. Then the counter 046 will be 047, and the counter after the
"V" for this counter will start from "01" and go to "V05". Then we will
go to raise the first counter by one again. until that first counter
reaches to 300.

i.e.The first 11 entries will be
NF06046v01
NF06046v02
NF06046v03
NF06046v04
NF06046v05
NF06047v01
NF06047v02
NF06047v03
NF06047v04
NF06047v05
NF06048v01
...
Thanks for any help.




[email protected]

help with macro about data entry with double counter
 
Thanks Nigel....



All times are GMT +1. The time now is 01:37 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com