+ Reply to Thread
Results 1 to 4 of 4

help with macro about data entry with double counter

  1. #1

    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.


  2. #2
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    do you want this as a formula or a macro

  3. #3
    Nigel
    Guest

    Re: 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



    <[email protected]> wrote in message
    news:[email protected]...
    > 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.
    >




  4. #4

    Re: help with macro about data entry with double counter

    Thanks Nigel....


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1