0

I am new to VBA and have an issue with calling my function:

My function is as follows:

Function pricing(priceSchedule As String, cellValue As String)

MsgBox (priceSchedule)
MsgBox (cellValue)

End Function

When I call it:

pricing("Master Sheet", "G8")

I get the error:

Compile error: 
Expected: =

Could someone please help? Thanks!

1 Answer 1

2

Normally a Function returns something and what you have here should be a Sub.

You should just remove the curly brackets for the MsgBox calls.

MsgBox priceSchedule
MsgBox cellValue

If you use the function without storing a value then

Call pricing("Master Sheet", "G8")

Or

pricing "Master Sheet", "G8"

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.