If then statement Structure in Code - macro does not execute

jwpardo

New Member
Joined
Dec 17, 2003
Messages
22
If have a macro with an if then else structure. I will show it below, however, the macro skips over the if then else stmt. Also, no error shows up before or after the execution in the module.

Any thoughts.
Thanks
James

(PS: framestyle and hoiststyle are names of cells in the only open worksheet.)

Sub hoist_option_2button()
'
' hoist_option_2button Macro
' hoist option 2 logic

' Range("whatnow").select
Range("whatnow").Value = 9

' If range("framestyle").value= 2 Then range("hoiststyle").value= 9 Else range("hoiststyle").value=2


'
End Sub
[/quote][/code]
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Re: If then statement Structure in Code - macro does not exe

Well, that portion of the macro is commented out (the single quote at the beginning), that's probably why...
 
Upvote 0
Re: If then statement Structure in Code - macro does not exe

Try removing the ' :)
 
Upvote 0
Re: If then statement Structure in Code - macro does not exe

Thank you all. Removing the ' solved my problem.
james
 
Upvote 0

Forum statistics

Threads
1,216,373
Messages
6,130,235
Members
449,568
Latest member
mwl_y

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