Checkbox event crash (Excel 97)

  • Thread starter Thread starter Ben
  • Start date Start date
B

Ben

I have a checkbox with the folloing macro assigend to it

Sub ResourceGroupFilter()
Call UnhideAllColumns
If ThisWorkbook.Worksheets("All Data").CheckBoxes("Resource Group").value
= xlOff Then
Call HideColumn("Resource Group")
End If
End Sub

This causes Excel to crash and die. I think it is due to the fact that the
"All Data" worksheet is the one containing the checkbox. If I just try to
assign the ThisWorkbook.Worksheets("All Data") to a worksheet object, it
also crashes excel. Is there anywas around this?

TIA
Ben
 
Hi Ben

It worked ok here just with

ThisWorkbook.Worksheets("All Data").CheckBoxes("Resource Group").Value =
xlOff

Are you sure this is the problem code?

Try deleting the checkbox, saving and replacing it.

***** Posted via: http://www.ozgrid.com
Excel Templates, Training & Add-ins.
Free Excel Forum http://www.ozgrid.com/forum *****
 
Doesn't work for me

I just created a brand new worksheet with a check box entitled "Resource
Group" and a button with the following code

Sub ClickIt()
ThisWorkbook.Worksheets("Sheet1").CheckBoxes("Resource Group").Value =
xlOff
End Sub

.... I get the error: Unable to get the CheckBoxes property of the worksheet
class. At least is doesn't die, I suppose ;o)

Any ideas?
Ben
 
It is probably because when the checkbox is selected it is given focus
Try putting this as the first line of your macro to change this :-

ActiveSheet.Range("A1").Selec
 
Back
Top