Visor
Member
I have a userform and I want to load an automatic numbering in column A, starting in cell 10.
I do not find the logic
first I place in the range A10 the value of 1
then I ask him to look for the last occupied row of column A,
The answer is A10
and then I ask that the next empty row is to say A10 + 1 = A11
Add the value of the last row A10 to the value of 1
the result should be 2 in the range A11
In the next load of the userform it should add to the A11 the value of 1 and its result be 3
Unfortunately in A10 you will always have to load the value of 1 since at the beginning the cell would be empty and from there all part of a row without data
Take into account that in A9 I have titles (string) and these do not add up (they would give error)
Apparently everything is fine, but it causes me error
I thank you in advance for your observations and suggestions
I do not find the logic
first I place in the range A10 the value of 1
then I ask him to look for the last occupied row of column A,
The answer is A10
and then I ask that the next empty row is to say A10 + 1 = A11
Add the value of the last row A10 to the value of 1
the result should be 2 in the range A11
In the next load of the userform it should add to the A11 the value of 1 and its result be 3
Unfortunately in A10 you will always have to load the value of 1 since at the beginning the cell would be empty and from there all part of a row without data
Take into account that in A9 I have titles (string) and these do not add up (they would give error)
Code:
sub num()
Hoja25.Range("A10").Value = 1
nfil = Hoja25.Range("A10:A" & Rows.Count).End(xlDown).Row
Hoja25.Range("A" & nfil + 1).Value = Hoja25.Range("A" & nfil).Value + 1
end sub
Apparently everything is fine, but it causes me error
I thank you in advance for your observations and suggestions