Can anyone help me. I am trying to create a macro that will assign a Unique Identifier Number in sequence when a button is clicked and it puts the number on the first blank row it finds in column A.
The numbers would be A100, A102, etc...
What I have so far is just giving me 1,2,3, etc. I would also need to know how to reset the macro in case we needed to go back to A100.
I have this so far:
Thank you in advance for any help.
The numbers would be A100, A102, etc...
What I have so far is just giving me 1,2,3, etc. I would also need to know how to reset the macro in case we needed to go back to A100.
I have this so far:
Code:
Sub Create_Invoice_Number()
Dim InvoiceNumber As Name
On Error Resume Next
InvoiceNumber = Names.Add("InvoiceNumber", Evaluate("InvoiceNumber") + 1)
If InvoiceNumber Is Nothing Then Set InvoiceNumber = Names.Add("InvoiceNumber", 1)
' Add Unique Invoice # To Cell A4
InvoiceNumber.Visible = False
Range("A4") = Evaluate("InvoiceNumber")
End Sub
Thank you in advance for any help.
Last edited by a moderator: