I have multiple buttons that are to the right of different tables, all stacked vertically. when I press the button it adds a new row to the top of the table and shifts the other rows down - exactly what i want. However it seems that the buttons are not moving with the first row of the tables so after a few clicks of each, everything is misaligned. how can i keep my buttons anchored to the first rows of their respective tables.
this is my code:
Private Sub CommandButton1_Click()
Dim mySheets
Dim i As Long
mySheets = Array("Highland")
For i = LBound(mySheets) To UBound(mySheets)
With Sheets(mySheets(i))
.Range("OP_DATE").EntireRow.Insert Shift:=xlDown
.Range("OP_DATE:lineOP").Borders.Weight = xlThin
End With
Next i
End Sub
Private Sub CommandButton2_Click()
Dim mySheets
Dim i As Long
mySheets = Array("Highland")
For i = LBound(mySheets) To UBound(mySheets)
With Sheets(mySheets(i))
.Range("P_DATE").EntireRow.Insert Shift:=xlDown
.Range("P_DATE:lineP").Borders.Weight = xlThin
End With
Next i
End Sub
Private Sub CommandButton3_Click()
Dim mySheets
Dim i As Long
mySheets = Array("Highland")
For i = LBound(mySheets) To UBound(mySheets)
With Sheets(mySheets(i))
.Range("S_DATE").EntireRow.Insert Shift:=xlDown
.Range("S_DATE:lineS").Borders.Weight = xlThin
End With
Next i
End Sub