How to change a checkbox if checked to an asterisk when printing in excel?

Excellman

New Member
Joined
Nov 18, 2020
Messages
4
Office Version
  1. 2016
Platform
  1. Windows
Is it possible to change a checkbox, if checked, to an asterisk only during printing in excel?
But if the checkbox is not checked then it would print normally as an empty checkbox.
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Fill the cell that is normally hidden by the checkbox with the asterix.

Then locate "ThisWorkbook vba Module" and load there the following macro:
Code:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
With Sheets("Foglio1").CheckBox1    '<<< The Sheet and the Control name
    If .Value = True Then
        .PrintObject = False
    Else
        .PrintObject = True
    End If
End With
End Sub
The line marked <<< need to be customized with the sheet name and the correct control name; by the way, I assumed that you are using an ActiveX checkbox (not a "Modules" one).

The macro will change the control's print property to True (if the checkbox is empty) or False (if the checkbox is checked)

Bye
 
Upvote 0
Hmmm... this Macro Module didn't work. It had no affect on the checkboxes. I'm not sure what you meant by "Fill the cell that is normally hidden by the checkbox with the asterix." I will post an image to help clarify what I'm looking to do... The first image is of the checkboxes with two of them checked and the others not checked. The checked ones would be replaced by an asterisks and the unchecked ones will just go away and not be printed, as in the 2nd image. Also, what should the settings be for each checkbox under 'format control' ---> Properties ---> Print Object; checked or unchecked? <--- This has an affect on whether the checkbox is printed or not and I don't know if the VBA code overrides this setting or not. Thanks for your input.
 

Attachments

  • image.jpg
    image.jpg
    94.2 KB · Views: 12
Upvote 0
By "Fill the cell that is normally hidden by the checkbox with the asterix." I mean the following:
-if you insert a checkbox in say position B1 then the cell will be hidden by the checkbox
-if you write an * in that hidden position, then the * will be unvisible if the checkbox is not checked and the macro will set its property to Print-the-Object to True; if hovever the checkbox is checked than the macro will hide in the printout the checkbox so that the * get visible on the print

But now you ask that anyway the checkbox be not printed, so that macro will not do the job, we have to set or remove the * in the cell behind the chcckbox

Also you have many checkboxes, and all of them should be manipulated, and that requires further coding.
However the image leaves too many unclear situations, if you publish a sample of your workbook maybe we shall be able to come with an applicable solution.

Bye
 
Upvote 0

Forum statistics

Threads
1,216,172
Messages
6,129,290
Members
449,498
Latest member
Lee_ray

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