If Then Button Help

MWhiteDesigns

Well-known Member
Joined
Nov 17, 2010
Messages
644
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.
 

Some videos you may like

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

buxtongt

Well-known Member
Joined
Oct 5, 2011
Messages
709
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.
 

buxtongt

Well-known Member
Joined
Oct 5, 2011
Messages
709
Set the t and r to the cells you associated each check box with or change them to checkboxname.value. Hope this helps.
 

MWhiteDesigns

Well-known Member
Joined
Nov 17, 2010
Messages
644
Office Version
  1. 2016
Platform
  1. Windows

ADVERTISEMENT

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 :)
 

MWhiteDesigns

Well-known Member
Joined
Nov 17, 2010
Messages
644
Office Version
  1. 2016
Platform
  1. Windows
And you can actually leave out the mail active sheet both, i just need richmond and tampa
 

MWhiteDesigns

Well-known Member
Joined
Nov 17, 2010
Messages
644
Office Version
  1. 2016
Platform
  1. Windows

ADVERTISEMENT

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
 

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Maybe

Code:
If RichmondButton.Value = True Then
    Mail_ActiveSheetRichmond
ElseIf TampaButton.Value = True Then
    Mail_ActiveSheetTampa
Else
    'something else
End If
 

MWhiteDesigns

Well-known Member
Joined
Nov 17, 2010
Messages
644
Office Version
  1. 2016
Platform
  1. Windows
VOG, as always, you are the man! I was pretty close attempting it by myself this time though!
 

Watch MrExcel Video

Forum statistics

Threads
1,123,330
Messages
5,601,000
Members
414,419
Latest member
JRDunya

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