Hugoprince
New Member
- Joined
- Feb 24, 2015
- Messages
- 1
Hi
I'm new to creating macro's!
I've found some code that adds a new row below a specified range and I've got this working.
However the issue I have is that I have created multiple macro buttons for each sub-element of the schedule and when I click "Add Row" and a new row is added to the first sub-element all the below "add Row" macro buttons are then thrown out of synch. I want the code to allow for added rows above, so that the below "Add row" buttons automatically move down.
The code I have used is:
Private Sub CommandButton21_Click()
Sheets("Sheet1").Range("A8").Select
ActiveCell.EntireRow.Insert Shift:=xlDown
Sheets("Sheet1").Range("A8:F8").Select
Selection.Borders.Weight = xlThin
End Sub
Private Sub CommandButton210_Click()
Sheets("Sheet1").Range("A60").Select
ActiveCell.EntireRow.Insert Shift:=xlDown
Sheets("Sheet1").Range("A60:F60").Select
Selection.Borders.Weight = xlThin
End Sub
Private Sub CommandButton211_Click()
Sheets("Sheet1").Range("A65").Select
ActiveCell.EntireRow.Insert Shift:=xlDown
Sheets("Sheet1").Range("A65:F65").Select
Selection.Borders.Weight = xlThin
End Sub
can anyone help?
thanks
I'm new to creating macro's!
I've found some code that adds a new row below a specified range and I've got this working.
However the issue I have is that I have created multiple macro buttons for each sub-element of the schedule and when I click "Add Row" and a new row is added to the first sub-element all the below "add Row" macro buttons are then thrown out of synch. I want the code to allow for added rows above, so that the below "Add row" buttons automatically move down.
The code I have used is:
Private Sub CommandButton21_Click()
Sheets("Sheet1").Range("A8").Select
ActiveCell.EntireRow.Insert Shift:=xlDown
Sheets("Sheet1").Range("A8:F8").Select
Selection.Borders.Weight = xlThin
End Sub
Private Sub CommandButton210_Click()
Sheets("Sheet1").Range("A60").Select
ActiveCell.EntireRow.Insert Shift:=xlDown
Sheets("Sheet1").Range("A60:F60").Select
Selection.Borders.Weight = xlThin
End Sub
Private Sub CommandButton211_Click()
Sheets("Sheet1").Range("A65").Select
ActiveCell.EntireRow.Insert Shift:=xlDown
Sheets("Sheet1").Range("A65:F65").Select
Selection.Borders.Weight = xlThin
End Sub
can anyone help?
thanks