I have a spreadsheet which is reused every month. The "PS" sheet contains a variable number of rows determined by the monthly raw data that will be inserted. The actual data is copied from one workbook to the PS sheet, with formulas interspersed on each row in several columns. Each month I delete the old data, retain the formulas in row 2, and then copy row 2 to how many rows the new data needs; usually around 1500.
To automate this I want to first show an input box where I can state how many rows are needed. Then insert the copied row into the range. I see two ways to perform this, but part of each is eluding me. The insert shift.xldown seems to be the fastest. The loop would be the second choice.
I have this:
Sub Macro1()
'
' Macro1 Macro
Dim x As Integer
Sheets("PS").Select
x = InputBox("How Many Rows of Raw Data?", "Add Rows")
'
'
Rows("2:2").Select
Selection.Copy
'Here is where I get lost
Rows("3:" & X).Select or maybe Range("A3:A" & X).Selection.Insert Shift:=xlDown
End Sub
This should be easy, but I am not getting it.
Help! any suggestions?
To automate this I want to first show an input box where I can state how many rows are needed. Then insert the copied row into the range. I see two ways to perform this, but part of each is eluding me. The insert shift.xldown seems to be the fastest. The loop would be the second choice.
I have this:
Sub Macro1()
'
' Macro1 Macro
Dim x As Integer
Sheets("PS").Select
x = InputBox("How Many Rows of Raw Data?", "Add Rows")
'
'
Rows("2:2").Select
Selection.Copy
'Here is where I get lost
Rows("3:" & X).Select or maybe Range("A3:A" & X).Selection.Insert Shift:=xlDown
End Sub
This should be easy, but I am not getting it.
Help! any suggestions?