lezawang
Well-known Member
- Joined
- Mar 27, 2016
- Messages
- 1,805
- Office Version
- 2016
- Platform
- Windows
Hi I have a form to enter First and Last name and when I click on Enter to enter them, excel will put these 2 names in the last empty row. To grantee the last empty row, there are 2 ways (code). Thanks for your help I got to know them but could not understand them!. The first one
x = WorksheetFunction.CountA(Range("A:A")) + 1
Cells(x, 1) = First.Value
Cells(x, 2) = last.Value
Let say A1:A10 are filled with numbers, except A5 which is empty. Then CountA(A:A) will return 9. so X will be 10 as per above
but row 10 so empty?
There is another way, which I have hard time to understand it. I am sure it is perfect coding but hard to interpret
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row + 1
Any help would be very much appreciate it
x = WorksheetFunction.CountA(Range("A:A")) + 1
Cells(x, 1) = First.Value
Cells(x, 2) = last.Value
Let say A1:A10 are filled with numbers, except A5 which is empty. Then CountA(A:A) will return 9. so X will be 10 as per above
but row 10 so empty?
There is another way, which I have hard time to understand it. I am sure it is perfect coding but hard to interpret
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row + 1
Any help would be very much appreciate it