I´m trying to add a id generator for a form that creates a unique ID in sequence (letters and numbers) and automatically adds to the first cell in the excel sheet.
So far no sucess, any solutions?
Thank you.
This is what i got:
So far no sucess, any solutions?
Thank you.
This is what i got:
VBA Code:
Private Sub CommandButton3_Click()
Dim emptyRow As Long
Dim LR As Integer
'Make Sheet1 active
Sheet15.Activate
'Determine emptyRow
emptyRow = WorksheetFunction.CountA(Range("A:A")) + 1
'ID generator
LR = Range("A" & Rows.Count).End(xlUp).Row
Range("A" & LR + 1) = "A" + CStr(Right(Cells(LR, 1).Text, Len(Cells(LR, 1).Text) - 1) + 1)
'Transfer information
Cells(emptyRow, 1).Value = A
Cells(emptyRow, 2).Value = TextBox1.Value
Cells(emptyRow, 3).Value = ComboBox1.Value
Cells(emptyRow, 4).Value = ComboBox2.Value
Cells(emptyRow, 5).Value = TextBox12.Value
Cells(emptyRow, 6).Value = ComboBox4.Value
Cells(emptyRow, 7).Value = ComboBox10.Value
Cells(emptyRow, 8).Value = TextBox11.Value
Cells(emptyRow, 9).Value = ComboBox6.Value
Cells(emptyRow, 10).Value = ComboBox7.Value
Cells(emptyRow, 11).Value = ComboBox8.Value
Cells(emptyRow, 12).Value = ComboBox9.Value
Cells(emptyRow, 13).Value = TextBox4.Value
Cells(emptyRow, 14).Value = TextBox5.Value
Cells(emptyRow, 15).Value = TextBox6.Value
Cells(emptyRow, 16).Value = TextBox2.Value
Cells(emptyRow, 17).Value = TextBox3.Value
Cells(emptyRow, 18).Value = TextBox7.Value
Cells(emptyRow, 19).Value = TextBox9.Value
Cells(emptyRow, 20).Value = TextBox10.Value
Unload Me
End Sub