horizonblue
New Member
- Joined
- Dec 7, 2023
- Messages
- 16
- Office Version
- 2010
- Platform
- Windows
Hi,
Im using this VBA code at the moment.
Sub Macro1()
Dim i As Long, n As Variant
n = InputBox("How many rows:", "INSERT ROWS")
If n = "" Or Not IsNumeric Or n < 1 Then Exit Sub
If Int < Val Then Exit Sub
i = 10
Do While Cells(i, "B") <> ""
i = i + 1
Loop
Rows(i & ":" & i + n - 1).Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Rows(i - 1 & ":" & i - 1).Copy
Rows(i & ":" & i + n - 1).PasteSpecial Paste:=xlPasteFormulas
Rows(i & ":" & i + n - 1).PasteSpecial Paste:=xlPasteFormats
Application.CutCopyMode = False
End Sub
The problem is, that it is copying everything in the previous rows. I am only wanting it to copy column A. Does anyone know how to fix this?
I'm also needing help to ensure that every time a new row is added that the reference number ticks over to the next numerical value.
Im using this VBA code at the moment.
Sub Macro1()
Dim i As Long, n As Variant
n = InputBox("How many rows:", "INSERT ROWS")
If n = "" Or Not IsNumeric Or n < 1 Then Exit Sub
If Int < Val Then Exit Sub
i = 10
Do While Cells(i, "B") <> ""
i = i + 1
Loop
Rows(i & ":" & i + n - 1).Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Rows(i - 1 & ":" & i - 1).Copy
Rows(i & ":" & i + n - 1).PasteSpecial Paste:=xlPasteFormulas
Rows(i & ":" & i + n - 1).PasteSpecial Paste:=xlPasteFormats
Application.CutCopyMode = False
End Sub
The problem is, that it is copying everything in the previous rows. I am only wanting it to copy column A. Does anyone know how to fix this?
I'm also needing help to ensure that every time a new row is added that the reference number ticks over to the next numerical value.