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]
 

Some videos you may like

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
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
 

Watch MrExcel Video

Forum statistics

Threads
1,122,577
Messages
5,596,996
Members
414,116
Latest member
sfullnet

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
Top