wakefield101
New Member
- Joined
- Jan 4, 2014
- Messages
- 31
I have two unformatted tables in my excel worksheet. The tables are vertical from one another. I have successfully created a macro button that adds 1 row under the header of the first table. However, adding a row to the second table simultaneously is where I am having trouble.
What I want to accomplish: Create a button that will add row below the header of unformatted table 1 THEN add a row below the header of the second table.
Goal: If I need to add 10 lines to each table, all I need to do is click my add row button ten time.
The issue that I am having is that the row reference for table 2 is not adjusting when a new row is added to table 1. When I insert a row in table 1 it shifts all data down one row. Then Table 2 is referencing a row above where it should be rather than adjusting to the change.
Does anyone know how to resolve this issue?
Here is my current VBA Code.
Sub AddRow_24MoGrid()
'
' Add Row_GridFcst Macro
'
Sheets("SF Client Grid 24mo Fcst").Rows("13:13").Select
Selection.Copy
Selection.Insert Shift:=xlDown
Application.CutCopyMode = False
Sheets("SF Client Grid 24mo Fcst").Rows("149:149").Select
Selection.Copy
Selection.Insert Shift:=xlDown
Application.CutCopyMode = False
End Sub
What I want to accomplish: Create a button that will add row below the header of unformatted table 1 THEN add a row below the header of the second table.
Goal: If I need to add 10 lines to each table, all I need to do is click my add row button ten time.
The issue that I am having is that the row reference for table 2 is not adjusting when a new row is added to table 1. When I insert a row in table 1 it shifts all data down one row. Then Table 2 is referencing a row above where it should be rather than adjusting to the change.
Does anyone know how to resolve this issue?
Here is my current VBA Code.
Sub AddRow_24MoGrid()
'
' Add Row_GridFcst Macro
'
Sheets("SF Client Grid 24mo Fcst").Rows("13:13").Select
Selection.Copy
Selection.Insert Shift:=xlDown
Application.CutCopyMode = False
Sheets("SF Client Grid 24mo Fcst").Rows("149:149").Select
Selection.Copy
Selection.Insert Shift:=xlDown
Application.CutCopyMode = False
End Sub