1
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.

Community
  • 1
  • 1
Jaanus
  • 16,161
  • 49
  • 147
  • 202

2 Answers2

9

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.

Community
  • 1
  • 1
GSerg
  • 76,472
  • 17
  • 159
  • 346
0

I kept getting this compile error syntax error, I copied code from here: https://learn.microsoft.com/en-us/previous-versions/office/developer/office-2007/bb206765(v=office.12)?redirectedfrom=MSDN
So the code should be good.

Then, somehow, I removed all the leading empty spaces for all lines, the error goes away! So it seems, the vba editor is not very tolerant, it doesn't like certain invisible printing-control characters.

Cocu_1012
  • 109
  • 3