Call a procedure using a variable

R

ranswrt

Is there a way to call a procedure using a variable? I tried

Call reportname & "Report"

reportname is a string variable. I got a error when I tried this.
Thanks
 
D

Dave Peterson

application.run reportname & "Report"


Is there a way to call a procedure using a variable? I tried

Call reportname & "Report"

reportname is a string variable. I got a error when I tried this.
Thanks
 
J

JLGWhiz

Whatever you use after the word "Call" must equate to the procedure name
only, with any arguments place in parentheses.
myProcedure = DoASort
Call myProcedure(Range("A1:A100")

Unless the concatenated word is part of the name, it will throw an error.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top