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

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
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,213,491
Messages
6,113,963
Members
448,536
Latest member
CantExcel123

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