Hi All,
In another thread I discussed about auto insert and get support from @HaHoBe and now I tried to make the input box only can fill by fix four values (DM, DT, DS and DW) and each value was set the amount such DM is 4, DS is 4, DT is 5 and DW is 8.
I tried using If fiction, and I don't know why not working, whether any one can help me
Plan to modify by adding "line" and change "lngNrRows" with line
This is the Original
Thank You
In another thread I discussed about auto insert and get support from @HaHoBe and now I tried to make the input box only can fill by fix four values (DM, DT, DS and DW) and each value was set the amount such DM is 4, DS is 4, DT is 5 and DW is 8.
I tried using If fiction, and I don't know why not working, whether any one can help me
Plan to modify by adding "line" and change "lngNrRows" with line
VBA Code:
Dim lngRow As Long
Dim lngNrRows As Long
Dim line As Long
lngNrRows = InputBox(Prompt:="Fill number line to insert")
If lngNrRows = "DW" Then line = 4
ElseIf lngNrRows = "DS" Then line = 4
ElseIf lngNrRows = "DT" Then line = 5
ElseIf lngNrRows = "Dw" Then line = 8
End If
This is the Original
VBA Code:
Private Sub Click_Click()
'On Error Resume Next
Dim lngRow As Long
Dim lngNrRows As Long
lngNrRows = InputBox(Prompt:="Fill number line to insert")
lngRow = InputBox(Prompt:="Fill number line to insert")
With ThisWorkbook.Sheets("Sheet2")
.Cells(lngRow - 1, "A").Resize(1, 8).Copy
.Cells(lngRow, "A").Resize(lngNrRows, 8).Insert Shift:=xlDown
End With
With ThisWorkbook.Sheets("Sheet1")
.Cells(lngRow - 1, "A").Resize(1, 8).Copy
.Cells(lngRow, "A").Resize(lngNrRows, 8).Insert Shift:=xlDown
End With
End Sub
Thank You