Vba if statement help

bloodmilksky

Board Regular
Joined
Feb 3, 2016
Messages
202
Hi Guys,

I am just experimenting and trying to learn VBA. I was just wondering if anyone knew the VBA Code for:

IF Range "A" Exceeds "X" Value Then Move To Sheet A

Thank you.
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Do you mean something like this:
Code:
If Range("A1") > X Then Sheets("Sheet A").Select
where X is some value, i.e. maybe
X=10
or
X=Range("B1").Value
is set somewhere earlier in the code.
 
Last edited:
Upvote 0
...or do you mean

Code:
If Range("A1") > Range("X1") Then Sheets("Sheet A").Select
 
Last edited:
Upvote 0
So I mean if cells A1:A3 exceed a value of 12 then move to Sheet A.
Do all three need to exceed 12, or just one of them?
 
Upvote 0
Try:
Code:
If Application.Sum(Range("A1:A3")) > 12 Then Sheets("Sheet A").Select
 
Upvote 0

Forum statistics

Threads
1,215,373
Messages
6,124,559
Members
449,171
Latest member
jominadeo

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