IF statements and Macros

rmcbreen

New Member
Joined
Oct 22, 2002
Messages
26
I am not sure that this is possible, but I want to write an if statemnet that will run a macro to print a page if a certain box is checked.

Example: If a box is checked to run a certain test, I want an IF statement that recognizes that the box is checked, and will print the test pages(seperate workbook) when I print the worksheet with the checked box.

Any ideas?

Actually, I am not sure that I would need to use IF statements, if there is a way to do this without IF's, that would be great too.

Thanks

Ryan
This message was edited by rmcbreen on 2002-10-23 18:09
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Right click on your check box, click on "Assign Macros" and click on "New". Then in the VBA editor, enter the following code

Sub CheckBox1_Click()

If ActiveSheet.CheckBoxes(Application.Caller).Value = xlOn Then
'(enter code here for printing worksheet)
End If

End Sub

If you do not know VBA well, you can turn on the macro recorder, open the workbook you want to print, print, and then stop the recorder. Then in VBA editor, copy the code you just recorded into the macro above.

Hope this helps.
 
Upvote 0
Bump: Macro If statements

I got the if statement, what do you put next to skip to next statement when the first criteria isn't met?
 
Upvote 0

Forum statistics

Threads
1,215,004
Messages
6,122,659
Members
449,091
Latest member
peppernaut

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