Call Macro

F

fi.or.jp.de

Hi All,

I have one main macro,

I have to call another macro like this

if Cells(1,"A").value = "AUSTRALIA" then Call Main_AUSTRALIA
if Cells(1,"A").value = "UNITED STATES" then Call Main_UNITED STATES

similarly there are 40 macros need to call.

Can i code like this

if Cells(1,"A").value <> "" then Call Main_& cells(1,"A").value

thanks in advance
 
C

Chip Pearson

You can use Application.Run to do this. E.g.,

Application.Run "Main_" & Cells(1,"A").Value

Cordially,
Chip Pearson
Microsoft MVP 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com
[email on web site]
 
D

Don Guillett

try it this way

Sub calla1()
On Error Resume Next
Application.Run "Main_" & Cells(1, "a")
End Sub
 
F

fi.or.jp.de

Thanks Don & Chip Pearson

It works great


try it this way

Sub calla1()
On Error Resume Next
Application.Run "Main_" & Cells(1, "a")
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software












- Show quoted text -
 

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