Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default comboBox properties


Hi,
I am looping through comboboxes in the active sheet using the following
code:
For Each myDD In ActiveSheet.OLEObjects
If TypeOf myDD.Object Is ComboBox Then
'ctrl is a checkbox, if the checkbox is checked then it will loop
to the
'corresponding comboBox
If myDD.Index = ctrl.Index - 1 Then
msgbox myDD.value
end if
end if
next myDD

so if a check box value is true then I want the value of the combobox
that is located next to the checkbox on the sheet to be displayed. The
above code does not work as there is no value property for this
object.

is there a better way of going about this? or can it be achieved this
way?

thanks in advance for any assistance


--
cmpcwil2
------------------------------------------------------------------------
cmpcwil2's Profile: http://www.excelforum.com/member.php...o&userid=33411
View this thread: http://www.excelforum.com/showthread...hreadid=552640

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default comboBox properties

Maybe something like this
Dim ctrl as OleObject, ctrl1 as OleObject
for each ctrl in Activesheet.OleObjects
if type of ctrl.Object is msforms.Checkbox then
if ctrl.Object.Value then
for each ctrl1 in Activesheet.OleObjects
if type of ctrl1.Object is msforms.Combobox then
if ctrl1.TopLeftCell.row = ctrl.TopLeftCell.row then
' msgbox ctrl1.name & " is next to " & ctrl.name & _
vbnewLine & " and value of " & ctrl1.name & " is " _
& vbnewLine & ctrl1.object.Value
exit sub
end if
end if
next
end if
Next

--
Regards,
Tom Ogilvy

"cmpcwil2" wrote:


Hi,
I am looping through comboboxes in the active sheet using the following
code:
For Each myDD In ActiveSheet.OLEObjects
If TypeOf myDD.Object Is ComboBox Then
'ctrl is a checkbox, if the checkbox is checked then it will loop
to the
'corresponding comboBox
If myDD.Index = ctrl.Index - 1 Then
msgbox myDD.value
end if
end if
next myDD

so if a check box value is true then I want the value of the combobox
that is located next to the checkbox on the sheet to be displayed. The
above code does not work as there is no value property for this
object.

is there a better way of going about this? or can it be achieved this
way?

thanks in advance for any assistance


--
cmpcwil2
------------------------------------------------------------------------
cmpcwil2's Profile: http://www.excelforum.com/member.php...o&userid=33411
View this thread: http://www.excelforum.com/showthread...hreadid=552640


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default comboBox properties


That's great thank you, the bit that had me confused was the myDD.value
when it should have been myDD.object.value.
Many thanks


--
cmpcwil2
------------------------------------------------------------------------
cmpcwil2's Profile: http://www.excelforum.com/member.php...o&userid=33411
View this thread: http://www.excelforum.com/showthread...hreadid=552640

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
Viewing combobox properties Manikandan Excel Discussion (Misc queries) 1 June 18th 07 03:30 PM
Change ComboBox properties in VBA? [email protected] Excel Programming 2 January 20th 06 03:34 PM
TextColumn Properties of ComboBox Brett Excel Discussion (Misc queries) 0 October 21st 05 11:26 PM
Setting properties to combobox Stefan[_6_] Excel Programming 2 September 16th 04 12:21 PM
ComboBox ProperTies Dan Gesshel Excel Programming 2 October 17th 03 01:08 AM


All times are GMT +1. The time now is 04:58 AM.

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"