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

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Juan Pablo González

MrExcel MVP
Joined
Feb 8, 2002
Messages
11,959
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...
 

NateO

Legend
Joined
Feb 17, 2002
Messages
9,700
Re: If then statement Structure in Code - macro does not exe

Try removing the ' :)
 

bjwillingham

Active Member
Joined
Jun 17, 2003
Messages
287
Re: If then statement Structure in Code - macro does not exe

I hate it when that happens. :oops:
 

jwpardo

New Member
Joined
Dec 17, 2003
Messages
22
Re: If then statement Structure in Code - macro does not exe

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

Watch MrExcel Video

Forum statistics

Threads
1,129,752
Messages
5,638,157
Members
417,011
Latest member
Amaden95

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
Top