Hi,
Just trying to work out how to convert a label which is setup to automatically increment each time Userform is loaded, to save as a Number.
The auto increment is working, but when pressing Submit on the Userform it is saving as Text instead of a Number, and unless I manually convert this to a number it stops auto incrementing.
Private Sub cmdNewHire_Click()
Dim erow As Long
erow = Sheet1.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
Cells(erow, 1) = Label1
Cells(erow, 2) = txtHireDate
Cells(erow, 3) = txtCustomerName
Cells(erow, 4) = txtEmail
Cells(erow, 5) = txtMobile
Cells(erow, 6) = txtLicence
Cells(erow, 7) = txtExpiry
Cells(erow, 8) = cmbHireType
Cells(erow, 9) = cmbLength
Cells(erow, 10) = cmbAccessories
Cells(erow, 11) = cmbBond
Cells(erow, 12) = txtAddress
Cells(erow, 13) = txtSuburb
Cells(erow, 14) = txtPostcode
Cells(erow, 15) = cmbState
Cells(erow, 16) = cmbStatus
Cells(erow, 17) = cmbStore
Label1 = Format(Label1.Caption, "")
End Sub
Private Sub UserForm_Initialize()
Dim x As Long
With Sheets("Sheet1")
x = Application.Max(.Columns("a"))
x = Application.Max(0, x) + 1
End With
Me.Label1.Caption = x
Just trying to work out how to convert a label which is setup to automatically increment each time Userform is loaded, to save as a Number.
The auto increment is working, but when pressing Submit on the Userform it is saving as Text instead of a Number, and unless I manually convert this to a number it stops auto incrementing.
Private Sub cmdNewHire_Click()
Dim erow As Long
erow = Sheet1.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
Cells(erow, 1) = Label1
Cells(erow, 2) = txtHireDate
Cells(erow, 3) = txtCustomerName
Cells(erow, 4) = txtEmail
Cells(erow, 5) = txtMobile
Cells(erow, 6) = txtLicence
Cells(erow, 7) = txtExpiry
Cells(erow, 8) = cmbHireType
Cells(erow, 9) = cmbLength
Cells(erow, 10) = cmbAccessories
Cells(erow, 11) = cmbBond
Cells(erow, 12) = txtAddress
Cells(erow, 13) = txtSuburb
Cells(erow, 14) = txtPostcode
Cells(erow, 15) = cmbState
Cells(erow, 16) = cmbStatus
Cells(erow, 17) = cmbStore
Label1 = Format(Label1.Caption, "")
End Sub
Private Sub UserForm_Initialize()
Dim x As Long
With Sheets("Sheet1")
x = Application.Max(.Columns("a"))
x = Application.Max(0, x) + 1
End With
Me.Label1.Caption = x