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 |
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 |
All times are GMT +1. The time now is 06:55 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com