Hi everyone,
Wondered if anyone could be of assistance. I am using the code below to insert a new row below the one in which the button is located (i.e. A16).
So far, so good. The kicker is that what was previously in A17 that has now been pushed down also has the same macro but when this is clicked it is still inserting rows at A17 (but now I want it to insert rows underneath it, say at A20). How can I make it so that the range selected is not fixed, but moving relative to where the macro is located/relocated?
Hope that made sense. Thanking all in advance.
Wondered if anyone could be of assistance. I am using the code below to insert a new row below the one in which the button is located (i.e. A16).
Code:
Private Sub CommandButton1_Click()
Sheets("Sheet1").Range("A17").Select
ActiveCell.EntireRow.Insert Shift:=xlDown
Sheets("Sheet1").Range("A17:J17").Select
Selection.Borders.Weight = xlThin
VerticalAlignment = xlCenter
End Sub
So far, so good. The kicker is that what was previously in A17 that has now been pushed down also has the same macro but when this is clicked it is still inserting rows at A17 (but now I want it to insert rows underneath it, say at A20). How can I make it so that the range selected is not fixed, but moving relative to where the macro is located/relocated?
Hope that made sense. Thanking all in advance.