Call Two Macros using IF condition

gvreddyhr

New Member
Joined
May 5, 2010
Messages
26
Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p></o:p>
<o:p> </o:p>
Thank you all for your timely support, I want to call two macros based on if condition, but I am not able to do it, can anyone tell me where am I going wrong..<o:p></o:p>

Code:
[SIZE=3][FONT=Calibri]Sub 2macrosusingif ()<o:p></o:p>[/FONT][/SIZE]
[SIZE=3][FONT=Calibri]Dim MyInput<o:p></o:p>[/FONT][/SIZE]
[SIZE=3][FONT=Calibri]MyInput = InputBox("Please Specify which macro needs to be called (send , Display) ")<o:p></o:p>[/FONT][/SIZE]
[SIZE=3][FONT=Calibri]If Myinput = Send then<o:p></o:p>[/FONT][/SIZE]
[SIZE=3][FONT=Calibri]Call Send()<o:p></o:p>[/FONT][/SIZE]
[SIZE=3][FONT=Calibri]Else if MyInput = Display then<o:p></o:p>[/FONT][/SIZE]
[SIZE=3][FONT=Calibri]Call Display()<o:p></o:p>[/FONT][/SIZE]
[SIZE=3][FONT=Calibri]End if<o:p></o:p>[/FONT][/SIZE]
[SIZE=3][FONT=Calibri]End Sub<o:p></o:p>[/FONT][/SIZE]
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Try like this

Code:
Sub macrosusingif()
Dim MyInput As String
MyInput = InputBox("Please Specify which macro needs to be called (Send or Display) ")
If MyInput = "Send" Then
    Call Send
ElseIf MyInput = "Display" Then
    Call Display
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,446
Messages
6,124,900
Members
449,194
Latest member
JayEggleton

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top