VBA Checkbox

Hiport

Active Member
Joined
May 9, 2008
Messages
455
Hi, the below code removes the tick from checkbox when workbook opens, how can i add this to a module so i can call this from a module sub rather than Thisworkbook?

ThisWorkbook.Worksheets("Tasks").CheckBox1.Value = False
 
Honestly not sure why it won't work, but you gain a huge benefit over doing it the way shg offered.

By using the codename you will ensure your code always works without having to trap for some type of error.

What if a user change your sheet name from Tasks to something else?

Your code will fail, but with the codename you can ensure it will always work.
 
Upvote 0

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Honestly not sure why it won't work, but you gain a huge benefit over doing it the way shg offered.

By using the codename you will ensure your code always works without having to trap for some type of error.

What if a user change your sheet name from Tasks to something else?

Your code will fail, but with the codename you can ensure it will always work.

Thats all good, my workbook is protected the user cant change anything.

I just find it bizzare why setting sheet does not accept it, i will try shg method.
 
Upvote 0

Forum statistics

Threads
1,224,567
Messages
6,179,569
Members
452,926
Latest member
rows and columns

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