# IF - Then statement not meeting criteria

#### aberenguel

##### Board Regular
Here's my code
Sub balance_transfer()
' balance_transfer Macro
' Written 09/13/2006 by Anthony Berenguel
'

'
Sheets("OUTPUT TRANSFER").Select

If Range("az235").Select = "FALSE" Then
Call rebalance_1
ElseIf Range("AZ235").Select = "FALSE" Then
Call rebalance_2
ElseIf Range("AZ235").Select = "FALSE" Then
Call rebalance_3
End If

End Sub

I have typed FALSE in cell AZ235 of the output transfer sheet. Therefore excel should call the rebalance_1() macro. But it doesn't. When i step through this code it never calls any of the rebalance macros even though AZ235 equals FALSE.

Anthony Berenguel

### Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},\$Z\$1:\$Z\$99,\$Y\$1:\$Y\$99),2,False) to lookup Y values to left of Z values.
Hi Anthony

You are testing the text "FALSE". Maybe AZ235 has the logical value FALSE and not the text "FALSE"?

If AZ235 has the logical value FALSE use

Code:
``````If Not Range("AZ235").Value Then
Call rebalance_1
Call rebalance_2
Call rebalance_3
End If``````
If indeed AZ235 has the text "FALSE", no need for the Select
Code:
``````If Range("AZ235").Value="FALSE" Then
Call rebalance_1
Call rebalance_2
Call rebalance_3
End If``````
Hope this helps
PGC

P. S.

Another solution, that will work in both cases, is to use the text property.
Code:
``````If Range("AZ235").Text="FALSE" Then
Call rebalance_1
Call rebalance_2
Call rebalance_3
End If``````
It works fine but is ambiguous, and so not recommended.

Hi,

you have "Select" which makes it always TRUE
you see ?
Code:
``````Sub test()
Range("A1") = True
MsgBox Range("A1").Select
Range("A1") = False
MsgBox Range("A1").Select
End Sub``````

kind regards,
Erik

Thank you, Erik, You are right. If the selection is successful it returns True no matter what is the value of the cell. In my case it's clear that the phrase "The mind is quicker than the hand" does not apply.

thanks everyone!

I have figured it out with all your help. The SELECT part was throwing me off. But thanks again!

Anthony

Replies
1
Views
257
Replies
2
Views
242
Replies
6
Views
302
Replies
9
Views
208
Replies
1
Views
305

1,219,798
Messages
6,150,318
Members
450,951
Latest member
kh198

### 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.

### Which adblocker are you using?

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

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