If Then Button Help

MWhiteDesigns

Well-known Member
Joined
Nov 17, 2010
Messages
646
Office Version
  1. 2016
Platform
  1. Windows
Good morning,
I am attempting to write an if end statement.

There are two buttons; button T and button R.

If button T is true, i want it to call a module named (mail_T)
If it is false, i want it to check the next button, button R.
If Button R is True, i want it to call a module named (mail_R)
if both buttons come back false, i want it to call Module TR.

How would this code look? I cant figure it out for the life of me. If the first button is true, it calls fine, but if its false, it doesnt do anything.
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
I can tell you what a formula to do this would look like:

=if(t=True,"mail_T",if(r=True,"mail_R","TR")

Hope this helps.
 
Upvote 0
Set the t and r to the cells you associated each check box with or change them to checkboxname.value. Hope this helps.
 
Upvote 0
Set the t and r to the cells you associated each check box with or change them to checkboxname.value. Hope this helps.


If (RichmondButton.Value = True,"Mail_ActiveSheetRichmond", if (TampaButton.Value=True, "Mail_ActiveSheetTampa","Mail_ActiveSheetBoth"))

I receive a compile error: Expected :)
 
Upvote 0
And you can actually leave out the mail active sheet both, i just need richmond and tampa
 
Upvote 0
I also tried the below:

Code:
If RichmondButton.Value = True Then
Mail_ActiveSheetRichmond
If TampaButton.Value = True Then
Mail_ActiveSheetTampa
End If
End If

It sends to the Richmond value fine.

But if its not richmond, and it needs to go to the tampa value. It just closes the form
 
Upvote 0
Maybe

Code:
If RichmondButton.Value = True Then
    Mail_ActiveSheetRichmond
ElseIf TampaButton.Value = True Then
    Mail_ActiveSheetTampa
Else
    'something else
End If
 
Upvote 0
VOG, as always, you are the man! I was pretty close attempting it by myself this time though!
 
Upvote 0

Forum statistics

Threads
1,214,548
Messages
6,120,146
Members
448,948
Latest member
spamiki

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