VBA does not accept my method calling and gives Compile error: Syntax error [duplicate]

Public Sub SavePendleValues(ByVal row1 As Integer, ByVal row2 As Integer)

Calling it

For sheetrow = 2 To 15 ' number of rows to scan
    SavePendleValues (sheetrow, sheetrow)
Next sheetrow

Getting error : Compile error: Syntax error

When I uncomment the line: SavePendleValues (sheetrow, sheetrow)

Everything works.


Solution 1:

Remove the parentheses.

SavePendleValues sheetrow, sheetrow

Otherwise you are trying to pass as a first argument something in parentheses that has two variables in it, which doesn't make sense for VBA parser.