How can I insert rows in all sheets with below vba code

Sub vba_add_row()
Dim iRow As Long
Dim iCount As Long
Dim i As Long

iCount = InputBox(Prompt:=“How many rows you want to insert?”)
iRow = InputBox _
(Prompt:=“Before which row you want to insert rows? (Enter the row number)”)
For i = 1 To iCount
Rows(iRow).EntireRow.Insert
Next i
End Sub

Hi @Raks_K

Before using invoke code,
Use two Input Dialog : Take the Number of rows to be inserted and from which row you want it in two different variables.

Pass them as input arguments to this Invoke VBA Activity and use them directly.

Thanks

Happy Automation! :slight_smile:

@Raks_K,

Update the VBA code like this.

image

Demo.txt.txt (140 Bytes)

Design workflow like this.

Invoke VBA:

Sample code:
VBA Sample.xaml (8.6 KB)

Thanks,
Ashok :slight_smile:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.