VBA Needed to Uncheck Boxes

Oceangirle

New Member
Joined
Mar 31, 2021
Messages
1
Office Version
  1. 2016
Platform
  1. Windows
Hello,

This is my first time posting. I am a bit perplexed on how to structure my VBA code to get started, as dealing with a dynamic tab coding issue is new territory for me.

I have a workbook whose sheets are labeled as follows (mm-yy) so the first sheet will be labeled (04-21) and then each month it will be copied and placed before with the tab name being manually updated to the next month (I.e. 05-21 will be a copy of 04-21 with a different sheet name). Once this is done, I would like the VBA code to clear the check boxes on the new sheet, but leave the check boxes as is on the old sheet. Thus , 05-21 should have no boxes checked, but 04-21 should have the same boxes checked as before. Any advice would be helpful for how to begin with the tab issue?
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

diddi

Well-known Member
Joined
May 20, 2004
Messages
3,300
Office Version
  1. 2010
Platform
  1. Windows
hi and welcome to MrExcel
this will clear all checkboxes on your worksheet
call it as follows:
VBA Code:
ClearChecks "04-21"

VBA Code:
Sub ClearChecks(MyWS As Worksheet)
    Dim cbx As CheckBox

    For Each cbx In MyWS.CheckBoxes
      cbx.Value = False
    Next cbx
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,129,860
Messages
5,638,732
Members
417,049
Latest member
baka416

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