[Solved] Formulas : Sequentially number selected items in a

  • Afternoon !


    I have a long list made up of about 8 different text items,


    I want to sequentially number each FG item .... ignoring the rest .... eg ..




    FG 0001
    Meat
    Meat
    FG 0002
    FG 0003
    Meat
    FG 0004


    Any clever way to do this ??


    Thanks,


    Colin

  • Try this


    Sub refit()
    Dim rngCell As Range
    Dim strmyint As Long
    strmyint = 1
    For Each rngCell In Range("A1:A100")
    If rngCell.Value = "FG" Then
    rngCell.Offset(0, 1).Value = "FG" & strmyint
    strmyint = strmyint + 1
    End If

    Next rngCell
    End Sub



    It will post FG1,FG2,FG3 etc in the column to the right of each instance of FG in A1:A100 ... amend ranges to suit your data

  • AZMVP....


    I'm doing something wrong !


    I made a test sheet with a1:a20 .


    Assigned your code to a macro button.


    ...but nothing happens when I click the button


    colin

  • The following would deal with both Upper & Lowercase entries



    Hope this helps

  • Here is a rather simple method:


    Filter the list on FG
    On the 1st FG item; chg to FG 0001
    Drag and fill down the filtered list.
    Unfilter the list and you will have a sequentialy numbered list

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!