+ Reply to Thread
Results 1 to 2 of 2

Auto numbering based on cell reference value

  1. #1
    Registered User
    Join Date
    02-28-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    2

    Auto numbering based on cell reference value

    I am blocked at problem. I have Table(in sheet1) which is filled with Form. Column A contains 20 codes as string(to be selected from combobox in Form) for easy understanding let us say "A", "B","C", "D","E","F". User selects this codes & enter "Amount" manually in Column B. I require auto numbering to be entered in Column C in following way :
    1) First all records to be searched for code "A" in column A & corresponding each records to be auto numbered in Column C from 1,2,3,4,5. Say table has 8 records it should stop at 8.
    2) Now again all records to be searched for code "B" in column A & auto numbering in column C should start from 9(after last record no of code "A").
    3) So on for code "C" then for code "D" & so on.
    4) At last all auto numbers in column C against Code "A" to be concatenate with separator "," & to be written in Sheet2! A2. For Code "B" in Sheet2! A3 & so on.

    I have tried to written VBA as follows for code "A" but don't know how to loop it for other code:
    Sub autonumbering()
    RowCount = Worksheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Row - 1
    Dim iCells As Long, j As Long, icells1 As Long
    j = 1
    For iCells = 0 To RowCount
    If Range("A1").Offset(iCells, 0).Value = "A" Then
    With Range("C1").Offset(iCells, 0)
    .Clear
    .Value = j
    j = j + 1
    End With
    Else
    End If
    Next iCells
    End Sub

    Please suggest.

    Thanks
    Mitesh

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Auto numbering based on cell reference value

    Hi, miteshan,

    please add code-tags to your procedure according to forum Rule #3 to allow us to answer to your thread.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Cell auto numbering - is this possible?
    By mega_nerd in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-15-2013, 05:50 AM
  2. Auto list into cell based on reference sheet
    By Dacodac in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-10-2013, 08:47 AM
  3. Replies: 5
    Last Post: 05-03-2012, 09:49 AM
  4. [SOLVED] Auto numbering in VBA based on the max number in a column.
    By muddbog in forum Excel General
    Replies: 8
    Last Post: 04-01-2012, 01:58 PM
  5. auto generate a comment box based on a cell value that has variable reference cells
    By vamedic11 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-31-2010, 06:56 AM

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