Ulisses_Carso
New Member
- Joined
- Sep 4, 2020
- Messages
- 39
- Office Version
- 365
- Platform
- Windows
good mornig, I burning my brain for two days with (i guess it is) a simple macro
I have a sheet with X number of rows, what I need is insert a new row above each existing row, wich I already did, now i need to put a formula in each new row.
imagine this: an array with 20x20 with 0 and 1,
each row have a X number of columns filled, wich dificults a little, because I don't want a formula with a blank cell bellow.
The formula can be anything, "=IF(a2="0";"zero";"one") for example.
I have a sheet with X number of rows, what I need is insert a new row above each existing row, wich I already did, now i need to put a formula in each new row.
imagine this: an array with 20x20 with 0 and 1,
each row have a X number of columns filled, wich dificults a little, because I don't want a formula with a blank cell bellow.
The formula can be anything, "=IF(a2="0";"zero";"one") for example.
VBA Code:
Sub InserLine()
Dim i As Long
For i = Range("A" & Rows.Count).End(xlUp).Row To 2 Step -1
If Cells(i, 1) <> Cells(i - 1, 1) Then Rows(i).Resize(1).Insert
Next i
End Sub