I have a function that is called and requires 2 passed variables
here is the first line:
Function dimErr(rngStart As Long, rngEnd As Long)
Now in the middle of this function I call a sub:
Call highlightLegitRows
Then the function carries on as intended.
Now, my problem is I now have optional variables associated with this sub:
Sub highlightLegitRows(Optional ByVal rngStart As Long = 0, Optional ByVal rngEnd As Long = 0)
When calling this sub, with the same values that have already been passed through, like so:
Call highlightLegitRows(rngStart, rngEnd)
My function appears to simply end at this line.
For example, this:
Call highlightLegitRows(rngStart, rngEnd)
MsgBox "hello"
would NOT trigger the message box. However this would:
Call highlightLegitRows
MsgBox "hello"
The only difference is the addition of these optional passed variables in the sub. Any idea where I am going wrong?
I haven't posted the whole function and sub as they are lengthy and complex, but both were working as intended before the above change.
On Error GoTostatements? That could also cause your code to jump out of the subroutine with execution passed to the error-handler.MsgSubwhenrngStartandrngEndare both explicitly0? i.e. is the problem caused by the existence of the parameters, or because of the values in the parameters?