Hi @Fluff and other
Sorry for making new threads here, I have some confused with the VBA Macro for insert new line and copying the formula above.
The macro actually runs, however, not as my expecting since have a difference between Sheet1 and Sheet2, here is the macro.
When I fill the number of insert line is 5, and choose a start the insert line from line 3, on Sheet2 the line only insert 4 lines with copying the formula above (line 2), however, in Sheet1 the line insert 5 line correctly from line 3 until 7.
There is a gap 1 line between Sheet 2 and Sheet1, I wish I can get the solution
When I fill the number of insert line is 5, and choose a start the insert line from line 3, on Sheet2 the line only insert 4 lines with copying the formula above (line 2), however, in Sheet1 the line insert 5 line correctly from line 3 until 7.
There is a gap 1 line between Sheet 2 and Sheet1, I wish I can get the solution
I Attached the file Sample
Sorry for making new threads here, I have some confused with the VBA Macro for insert new line and copying the formula above.
The macro actually runs, however, not as my expecting since have a difference between Sheet1 and Sheet2, here is the macro.
VBA Code:
Private Sub CommandButton1_Click()
On Error Resume Next
Dim iRow As Long
Dim iCount As Long
Dim i As Long
iCount = InputBox _
(Prompt:="Fill number line to insert")
iRow = InputBox _
(Prompt:="Choose the start line")
For i = 1 To iCount
ThisWorkbook.Sheets("Sheet2").Rows(iRow).EntireRow.Insert
ThisWorkbook.Sheets("Sheet2").Rows(Selection.Row - 1).Copy
ThisWorkbook.Sheets("Sheet1").Rows(iRow).EntireRow.Insert
ThisWorkbook.Sheets("Sheet1").Rows(Selection.Row - 1).Copy
Next i
End Sub
When I fill the number of insert line is 5, and choose a start the insert line from line 3, on Sheet2 the line only insert 4 lines with copying the formula above (line 2), however, in Sheet1 the line insert 5 line correctly from line 3 until 7.
There is a gap 1 line between Sheet 2 and Sheet1, I wish I can get the solution
When I fill the number of insert line is 5, and choose a start the insert line from line 3, on Sheet2 the line only insert 4 lines with copying the formula above (line 2), however, in Sheet1 the line insert 5 line correctly from line 3 until 7.
There is a gap 1 line between Sheet 2 and Sheet1, I wish I can get the solution
I Attached the file Sample