AND IF Macro

akvanden

New Member
Joined
Mar 30, 2009
Messages
24
Hi all,

Having some issues trying to figure out how to use the If statements when I need to have two or more conditions met. I need the conditions to say when the range equals 'Finance' AND when another range equals say 'X'. I've been searching all over the net and this site and cannot find what I need so I must be searching wrong - hoping the expertise on this site can help.

Thanks!



Sub Macro1()

Dim RetVal
If (Range("B2") = "Finance") Then
Sheets("Manual Bridge").Activate
Range("A1").Select
Else
Sheets("Pull Bridge").Activate
Range("A1").Select
End If
End Sub
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Something like...

If Range("B2") = "Finance" or range("myOtherRange")="X"
 
Upvote 0
Hello and welcome to MrExcel.

The syntax is

Code:
If Range("B2").Value = "Finance" And Range("C2").Value = "Income" Then
 
Upvote 0

Forum statistics

Threads
1,215,043
Messages
6,122,816
Members
449,095
Latest member
m_smith_solihull

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