johnsimer
johnsimer

Reputation: 350

Compile Error: Argument Not Optional

I have the following function:

Public Function getModuleAndEsnRange(fromSheetName As String, toSheetName As String, modulesColumn As Integer, firstModuleRow As Integer, esnsRow As Integer, firstEsnColumn As Integer) As String

    ...[code]...

    'returns the value
    getModuleAndEsnRange = moduleAndEsnRange

End Function

Elsewhere in the same module I call:

test = getModuleAndEsnRange(SHEET_WIP.Name, SHEET_WIP_DATA.Name, 1, 5, 3, 3)

And a box pops up that says "Compile Error: Argument Not Optional". It highlights in yellow the "Public Function getM... As String" and highlights in blue the "test = getM . . . 3, 3)"

What am I doing wrong? I have all 6 arguments listed when I call the function. . .

Upvotes: 0

Views: 2097

Answers (2)

johnsimer
johnsimer

Reputation: 350

Turns out I had another function inside of the code I had not listed. The function inside the code did not have the appropriate matching arguments.

Thank you all!

Upvotes: 0

Onlooker
Onlooker

Reputation: 1

Check to see if SHEET_WIP.Name and SHEET_WIP_DATA.Name are string values. It may be that one of them is null

Upvotes: 0

Related Questions