Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using a variable to represent a Checkbox Name(OLEObject)
Hi,
I would have thought this would be a simple matter My VBA code includes the following code ActiveSheet.Check_Box.Value = Range(Boolean_Identifier).Value ....where Check_Box is a variable containing the name of the checkbox I want to reference. This code is in a "For" loop and "Check_Box" gets populated with the names of over 200 checkboxes that I want to process in turn. Unfortunately the above line contantly errors on a "Type mismatch". If I substitute the actual name of one of the check boxes into the above line it works perfectly; though naturally, only for that particular check box. Obviously I am not defining or using my Check_Box variable properly. I have tried multiple definitions based on tips I've found here in the newsgroups to no effect. Can anyone please tell me how to properly reference the name of Checkbox as a variable? thank you, Mike Cooper |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using a variable to represent a Checkbox Name(OLEObject)
Mike,
Try this Activesheet.OLEObjects(Check_Box").Object.Value = Range(Boolean_Identifier).Value -- HTH ------- Bob Phillips ... looking out across Poole Harbour to the Purbecks "Mike Cooper" wrote in message om... Hi, I would have thought this would be a simple matter My VBA code includes the following code ActiveSheet.Check_Box.Value = Range(Boolean_Identifier).Value ...where Check_Box is a variable containing the name of the checkbox I want to reference. This code is in a "For" loop and "Check_Box" gets populated with the names of over 200 checkboxes that I want to process in turn. Unfortunately the above line contantly errors on a "Type mismatch". If I substitute the actual name of one of the check boxes into the above line it works perfectly; though naturally, only for that particular check box. Obviously I am not defining or using my Check_Box variable properly. I have tried multiple definitions based on tips I've found here in the newsgroups to no effect. Can anyone please tell me how to properly reference the name of Checkbox as a variable? thank you, Mike Cooper |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Change and refresh OLEObject showing Excel chart on Access form. | Charts and Charting in Excel | |||
to represent sheet | Excel Discussion (Misc queries) | |||
Change . to represent : | Excel Discussion (Misc queries) | |||
How to have Checkbox A uncheck with checked Checkbox B | Excel Discussion (Misc queries) | |||
Using a variable to represent the pathname in a formula | Excel Discussion (Misc queries) |