Need help at VB Code To enter variables

Hi All,

Sub DynamicRangeMacro(startRow As Integer, endRow As Integer)

  Sheets("AL Details (for Retail and V&M)").Range("A" & startRow & ":J" & startRow).AutoFill Destination:=Sheets("AL Details (for Retail and V&M)").Range("A" & startRow & ":J" & endRow), Type:=xlFillDefault

End Sub

Where i am passing variables as

But Getting This Error

Invoke VBA: Parameter not optional. (Exception from HRESULT: 0x8002000F (DISP_E_PARAMNOTOPTIONAL))

Suggest Me!!!

Thank You!!!

Hi @vineelag

Try this code:

Sub DynamicRangeMacro(startRow As Integer, endRow As Integer)
    Sheets("AL Details (for Retail and V&M)").Range("A" & startRow & ":J" & startRow).AutoFill Destination:=Sheets("AL Details (for Retail and V&M)").Range("A" & startRow & ":J" & endRow), Type:=xlFillDefault
End Sub

Hope it helps!!

Hi,

Did you set EntryMethodParameter property of InvokeVBA activity?
If not, please set as the following, for example.

new object(){1,10}

image

Regards,

1 Like

@Parvathy

Still Getting the same issue

@vineelag

Try setting this property in EntryMethodParameters od Invoke VBA activity

new object(){25,45}

Hope it helps!!

1 Like

Hi @Yoichi

By using this code i am not getting as excepted

i want to drag drop the row from 25 to 45 row but its drag and drop the rows from 1 to 10

can you suggest me on this please.

Thank You!!!

Hi,

Sorry 1,10 is just sample.

Can you try as the following?

New Object() {25,45}

Or.

New Object() {startRow, endRow}

Regards,

1 Like

Thank You @Yoichi
Your the Best !!!

1 Like

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