Hi
Can anyone please help me with some code? I'm very new to VBA
I have set up a user form for data entry of customer data. Each time a customer record is entered, I would like the Customer ID to increase by 1 to create a unique ID ie the first row of data is 101, the second 102, the third 103 etc.
Rather than do this on the data capture page, I would like to show the increasing ID in the user form so the user who are entering the data can keep track of how many records they have entered.
I have got as far as activating the data sheet, finding the next row and putting the customer number in it, but I'm not sure how to generate this number rather than create it each time.
Any help would be great - thank you!
Can anyone please help me with some code? I'm very new to VBA
I have set up a user form for data entry of customer data. Each time a customer record is entered, I would like the Customer ID to increase by 1 to create a unique ID ie the first row of data is 101, the second 102, the third 103 etc.
Rather than do this on the data capture page, I would like to show the increasing ID in the user form so the user who are entering the data can keep track of how many records they have entered.
I have got as far as activating the data sheet, finding the next row and putting the customer number in it, but I'm not sure how to generate this number rather than create it each time.
Any help would be great - thank you!
Code:
'Make sure Data is active
Sheets("Data").Activate
'Determine the next empty row
NextRow = Application.WorksheetFunction. _
CountA(Range("A:A")) + 1
'Transfer the Customer Number
Cells(NextRow, 1) = TextCustomerNumber.Value