Home > OS >  Insert numbered cells row based on cell value
Insert numbered cells row based on cell value

Time:06-24

I have managed to insert rows based on cell value for instance if A1 cell is 20, I run the macro, 20 rows appear under A1, those rows are blank right, I need the 20 new cells below A1 to be number 1 to 20 ( the number in A1) let me know if possible.

Cheers Adrien

CodePudding user response:

Try this:

Sub counter()
Dim i as integer
for i = 2 to cells(1, 1)   1
    cells(i, 1) = i - 1
next i
End Sub

CodePudding user response:

it tells me "type missmatch"

I have put a 2 pictures attached maybe to make myself clearer

[Step 1][1] [1]: https://i.stack.imgur.com/TrvZx.jpg [Step 2][2] [2]: https://i.stack.imgur.com/D044V.jpg

Thanks a lot

  • Related