columnA aaa | columnB 1 |
bbb | 0 |
ccc | 0 |
ddd | 0 |
eee | 4 |
fgh | 2 |
<tbody>
</tbody>
Hi there, am trying to write a code so rows are ( or not ) inserted depending on the value of the cell.
If cell value is 0 or 1, there shoulb be zero row inserted.
if cell value is 2 or greater, there should be 2 or more rows inserted.
Rows need to be inserted down.
Below is the code I have started to write but as I am new with VBA I am really struggling, does anybody knows how to write it properly? Many thanks
Sub jasmine()
Application.ScreenUpdating = False
Dim irow As Integer, lastrow As Integer
For irow = 1 To lastrow
If IsEmpty (Range("B" & irow))
Shift.xlDown
Else: ActiveCell.EntireRow.Resize(rowsize:=ActiveCell.Value).Insert Shift:=xlDown
End If
Columns("b").ClearContents
Application.ScreenUpdating = True
End Sub