#1   Report Post  
Posted to microsoft.public.excel.programming
MVM MVM is offline
external usenet poster
 
Posts: 53
Default combobox

I have 16 comboboxes on an excel sheet. When a change takes place, i want
some function to trigger. is there any way to write a generic function as an
event of 'change'. is there any way to identify the calling control?

thanks
MVM
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default combobox

There is no easy way around it: the comboboxes will only trigger their own
_change event, so they will all need their own event procedure to be
detected. If you needed to do this on a bigger scale, or planned to design
more workbooks with a similar feature, you could define a custom class with
its own events; but that would be a lot of work.

I have found the easiest way is to make a simple and easily copied and
modified event procedure to run and immediately call a "master" subroutine:

1) for the first combobox, write an event procedure like this:
Sub ComboBox1_Change()
Call ComboMain(1)
End Sub

2) Now copy this and paste the copy 15 times. Go to each, highlight it, and
do a Find/Replace (Ctrl H) to change 1 to 2, or 3, or 4, or 5, ... and so on
for each; e.g. the final one will look like this:

Sub ComboBox16_Change()
Call ComboMain(16)
End Sub

3) Now to tie it all together:
Sub ComboMain(CBNumber as Integer)
'CBNumber tells you which combobox was changed, so now do whatever you
need to do here
End Sub

It is not too bad to set up this way, and I think it can do what you want.
--
- K Dales


"MVM" wrote:

I have 16 comboboxes on an excel sheet. When a change takes place, i want
some function to trigger. is there any way to write a generic function as an
event of 'change'. is there any way to identify the calling control?

thanks
MVM

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
fill combobox depending on selection from another combobox Adam Francis Excel Discussion (Misc queries) 2 July 24th 08 07:39 PM
How Do I Load A ComboBox RowSource From The Results Of Another ComboBox Minitman[_4_] Excel Programming 3 October 26th 04 07:58 PM
Populating combobox from another combobox David Goodall Excel Programming 1 September 12th 04 03:42 PM
Combobox Value Nate Kolman Excel Programming 1 July 14th 04 01:07 PM
combobox value cg Excel Programming 5 September 28th 03 07:26 PM


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

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

About Us

"It's about Microsoft Excel"