Syntax error when calling VB routine?

In my Visual Basic code behind an Excel spreadsheet, I have one routine that takes parameters. This is called from another routine.

Here is the subroutine declaration:

Sub rowPasting(ByVal oldRow As Integer, ByVal newRow As Integer, ByVal oldSheet As Worksheet, ByVal newSheet As Worksheet) 

Here is the challenge:

 rowPasting(j,k,TTWorksheet,newSheet) 

All the variables that I use as input parameters for the parameters are set and valid because they were used for the working parts of the program before I tried to add this new subroutine.

Any ideas on what causes the syntax error on invocation?

+4
source share
1 answer

To call your routine, you need to use one of the following syntaxes:

 Call rowPasting(j,k,TTWorksheet,newSheet) 

or

 rowPasting j,k,TTWorksheet,newSheet 
+9
source

Source: https://habr.com/ru/post/1478879/


All Articles