Forum Discussion
OlbudMaciej
Mar 02, 2023Copper Contributor
Autofill numeration in row until last empty cell
Hi, How can I create macro which can autofill numeration in row. It have to end this macro at the end of this table. I was trying to make it in this way: It worked perfect, but in empty sheet. I...
NikolinoDE
Mar 02, 2023Gold Contributor
with out VBA:
=IF($B2<>"",COUNTA($B2:$B$2),"")
or with VBA
Sub Nummero()
Dim x As Long, j As Long, Z As Long
x = Cells(Rows.Count, 2).End(xlUp).Row
For j = 1 To x
If Not IsEmpty(Cells(j, 2)) Then Cells(j, 1) = Z + 1: Z = Z + 1
Next
End Sub
Example file is included.
Hope I could help you with these information.
I know I don't know anything (Socrates)
OlbudMaciej
Mar 02, 2023Copper Contributor
Thank you for help.
I copy and paste your code but it's not working.
I don't get ant error when I starting your code but it will do nothing.
- NikolinoDEMar 02, 2023Gold ContributorWhich Excel version do you have?...operating system, storage medium?
Does the inserted file work for you?- OlbudMaciejMar 02, 2023Copper Contributorhttps://drive.google.com/file/d/1kHRWKOA6HPGdMwsHp9Hb1QBISxLJw6ER/view?usp=sharing
Please check in my example- NikolinoDEMar 02, 2023Gold Contributor
Attached is the example in the file.
If I may recommend that you use the formula in your projects, I think it will be of more use to you.
Example with formula you will find in column "J".
When you write something in column K, the numbering appears as desired.