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
Bookmarks