I wrote a macro that originally had 0 arguments, and called the macro from a button on my Excel sheet. The design changed, and now I added two optional arguments to the macro, like this:
Function ButtonClick(Optional prop1 As String, Optional prop2 As String)
`Do stuff here
End Function
I am now trying to pass both arguments to the macro from the button, but get an error each time.
First I tried:
Sheet1.xlsm!ButtonClick(EVALUATE("A3"), EVALUATE("A4"))
as was suggested in this question, but got an error for That function isn't valid
.
I noticed that in the question, the top answer also called for surrounding the entire macro name in single quotes, so I did so:
'Sheet1.xlsm!ButtonClick(EVALUATE("A3"), EVALUATE("A4"))'
And this time got there error Formula is too complex to be assigned to an object
.
What am I doing wrong?