Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 620
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change and refresh OLEObject showing Excel chart on Access form. Chrisso Charts and Charting in Excel 0 December 23rd 08 05:57 PM
to represent sheet refina Excel Discussion (Misc queries) 1 June 14th 08 07:27 PM
Change . to represent : DB74 Excel Discussion (Misc queries) 11 March 7th 08 11:43 PM
How to have Checkbox A uncheck with checked Checkbox B Texas Aggie Excel Discussion (Misc queries) 3 July 20th 07 10:58 PM
Using a variable to represent the pathname in a formula David Jones Excel Discussion (Misc queries) 5 November 24th 06 05:37 AM


All times are GMT +1. The time now is 03:52 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"