Need help at VB Code To enter variables PASSING STREING VARIABLE

Hi All

i am using below vb code

Sub DynamicRangeMacro(startRow As Integer, endRow As Integer, sheetName As String)

Sheets(sheetName).Range("U" & startRow & ":CK" & startRow).AutoFill Destination:=Sheets(sheetName).Range("U" & startRow & ":CK" & endRow), Type:=xlFillDefault

End Sub

and properties are in UiPath

please kindly let me know how to pass the strong sheet name

please kindly let me know how can i achuve this.

thank you!!!

@Yoichi

Hi,

Do you have any error?

Regards,

1 Like

Hi @Yoichi

Its working now.

I want insert rows in excel and its showing code like below

Sub InsertRowsDynamic(sheetName As String, startRange As Range, numRows As Integer)

Dim ws As Worksheet
Set ws = Worksheets(sheetName)
startRange.Resize(numRows, 1).EntireRow.Insert , CopyOrigin:=xlFormatFromLeftOrAbove

End Sub

So how can i pass the variable startRange as Range type

Foe ex: if adding rows from A6 To 10 inserting rows

Will You please kindly help on this.

Thank You!!!