Hi
I am creating a VB form, which updates a spreadsheet, and as part of this creates a unique reference number.
I want the Ref number to be CUST/YY/unique number
I am struggling to get the year automatically, I have tried a couple of ways but it didnt work. Currently I am using the below fix, but would like the 19 to be auto generated so it will change every year. I also need to to start from 1 again when the year changes
eg if the ref was CUST/19/1234 I would like it to go to CUST/20/1 in 2020 and not just clock over to 1235. Thanks
'''defines what the variable is to refer to. _
(The row number of the last used cell in column A.)
emptyROW = Cells(Rows.Count, "A").End(xlUp).Row
lastROW = CLng(Cells(Rows.Count, "A").End(xlUp).Row) - 1
currentURN = "CUST/19" & "/" & CStr(emptyROW)
'Determine emptyRow
emptyROW = WorksheetFunction.CountA(Range("A:A")) + 1
Any assistance will be greatly appreciated
Thanks
I am creating a VB form, which updates a spreadsheet, and as part of this creates a unique reference number.
I want the Ref number to be CUST/YY/unique number
I am struggling to get the year automatically, I have tried a couple of ways but it didnt work. Currently I am using the below fix, but would like the 19 to be auto generated so it will change every year. I also need to to start from 1 again when the year changes
eg if the ref was CUST/19/1234 I would like it to go to CUST/20/1 in 2020 and not just clock over to 1235. Thanks
'''defines what the variable is to refer to. _
(The row number of the last used cell in column A.)
emptyROW = Cells(Rows.Count, "A").End(xlUp).Row
lastROW = CLng(Cells(Rows.Count, "A").End(xlUp).Row) - 1
currentURN = "CUST/19" & "/" & CStr(emptyROW)
'Determine emptyRow
emptyROW = WorksheetFunction.CountA(Range("A:A")) + 1
Any assistance will be greatly appreciated
Thanks