Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 576
Default Selecting/Activating Control Tools Combobox on Sheet

Working Excel97 SR2

I have a sheet with a number of comboboxes. When I enter a cell containing
a combobox I want to activate the combobox and do a
Combobox1.Dropdown

At present I am using event code for each cell but would like to write
generic code to identify the combobox in the cell. (I could use a secondary
column to contain the the combobox #)

Can anyone suggest code that could do something like
Comboboxx.Dropdown

Thanks in advance...
--
sb


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Selecting/Activating Control Tools Combobox on Sheet

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
for each oleObj on Activesheet.OleObjects
if oleObj.TopLeftCell.Address = Target.Address then
if typeof oleObj.Object is MSForms.Combobox then
oleObj.Object.DropDown
exit for
end if
end if
Next
End Sub

--
Regards,
Tom Ogilvy


"steve" wrote in message
...
Working Excel97 SR2

I have a sheet with a number of comboboxes. When I enter a cell

containing
a combobox I want to activate the combobox and do a
Combobox1.Dropdown

At present I am using event code for each cell but would like to write
generic code to identify the combobox in the cell. (I could use a

secondary
column to contain the the combobox #)

Can anyone suggest code that could do something like
Comboboxx.Dropdown

Thanks in advance...
--
sb




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 576
Default Selecting/Activating Control Tools Combobox on Sheet

Tom,

Works like a champ! Thanks Very Much! This will save me a lot of coding.

You always come through!

--
sb
"Tom Ogilvy" wrote in message
...
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
for each oleObj on Activesheet.OleObjects
if oleObj.TopLeftCell.Address = Target.Address then
if typeof oleObj.Object is MSForms.Combobox then
oleObj.Object.DropDown
exit for
end if
end if
Next
End Sub

--
Regards,
Tom Ogilvy


"steve" wrote in message
...
Working Excel97 SR2

I have a sheet with a number of comboboxes. When I enter a cell

containing
a combobox I want to activate the combobox and do a
Combobox1.Dropdown

At present I am using event code for each cell but would like to write
generic code to identify the combobox in the cell. (I could use a

secondary
column to contain the the combobox #)

Can anyone suggest code that could do something like
Comboboxx.Dropdown

Thanks in advance...
--
sb






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 576
Default Selecting/Activating Control Tools Combobox on Sheet

Tom,

Minor note:
Had to dim oleObj as OleObject (you knew that)
And had to change "on" to "in" (Excel insisted on that one)

--
sb
"Tom Ogilvy" wrote in message
...
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
for each oleObj on Activesheet.OleObjects
if oleObj.TopLeftCell.Address = Target.Address then
if typeof oleObj.Object is MSForms.Combobox then
oleObj.Object.DropDown
exit for
end if
end if
Next
End Sub

--
Regards,
Tom Ogilvy


"steve" wrote in message
...
Working Excel97 SR2

I have a sheet with a number of comboboxes. When I enter a cell

containing
a combobox I want to activate the combobox and do a
Combobox1.Dropdown

At present I am using event code for each cell but would like to write
generic code to identify the combobox in the cell. (I could use a

secondary
column to contain the the combobox #)

Can anyone suggest code that could do something like
Comboboxx.Dropdown

Thanks in advance...
--
sb






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Selecting/Activating Control Tools Combobox on Sheet

"on" was a typo.

I guess I omitted the dim statement.

--
Regards,
Tom Ogilvy

steve wrote in message
...
Tom,

Minor note:
Had to dim oleObj as OleObject (you knew that)
And had to change "on" to "in" (Excel insisted on that one)

--
sb
"Tom Ogilvy" wrote in message
...
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
for each oleObj on Activesheet.OleObjects
if oleObj.TopLeftCell.Address = Target.Address then
if typeof oleObj.Object is MSForms.Combobox then
oleObj.Object.DropDown
exit for
end if
end if
Next
End Sub

--
Regards,
Tom Ogilvy


"steve" wrote in message
...
Working Excel97 SR2

I have a sheet with a number of comboboxes. When I enter a cell

containing
a combobox I want to activate the combobox and do a
Combobox1.Dropdown

At present I am using event code for each cell but would like to write
generic code to identify the combobox in the cell. (I could use a

secondary
column to contain the the combobox #)

Can anyone suggest code that could do something like
Comboboxx.Dropdown

Thanks in advance...
--
sb










  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 576
Default Selecting/Activating Control Tools Combobox on Sheet

Tom,

You're more than forgiven... It works sooooooo good.
Having Option Explicit really helps catch this stuff...

Have you seen my follow-up question about a generic Combobox event?

What I want is to have the next cell selected after a combobox is changed.
ComboboxX_change
target.offset(1,0).select

--
sb
"Tom Ogilvy" wrote in message
...
"on" was a typo.

I guess I omitted the dim statement.

--
Regards,
Tom Ogilvy

steve wrote in message
...
Tom,

Minor note:
Had to dim oleObj as OleObject (you knew that)
And had to change "on" to "in" (Excel insisted on that one)

--
sb
"Tom Ogilvy" wrote in message
...
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
for each oleObj on Activesheet.OleObjects
if oleObj.TopLeftCell.Address = Target.Address then
if typeof oleObj.Object is MSForms.Combobox then
oleObj.Object.DropDown
exit for
end if
end if
Next
End Sub

--
Regards,
Tom Ogilvy


"steve" wrote in message
...
Working Excel97 SR2

I have a sheet with a number of comboboxes. When I enter a cell
containing
a combobox I want to activate the combobox and do a
Combobox1.Dropdown

At present I am using event code for each cell but would like to

write
generic code to identify the combobox in the cell. (I could use a
secondary
column to contain the the combobox #)

Can anyone suggest code that could do something like
Comboboxx.Dropdown

Thanks in advance...
--
sb










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
form control combobox Gail Excel Discussion (Misc queries) 7 October 2nd 09 07:27 PM
Control ToolBox ComboBox Steve D Excel Discussion (Misc queries) 1 July 1st 09 05:17 PM
Need to update a ComboBox when selecting a sheet [email protected] Excel Worksheet Functions 1 October 31st 07 02:23 PM
Use of Control Tools Kathy New Users to Excel 4 January 26th 05 06:59 PM
Selecting or Activating a cell. Scott Excel Programming 0 August 15th 03 09:22 AM


All times are GMT +1. The time now is 03:26 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"