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


Hi,
I have multiple VB toolbox comboBox's on a Excel spreadsheet, when a
selection change occurs it makes a call to a webservice to populate
adjacent cells with the returned data.

At the moment I have simply copied and pasted the code into each change
event for each ComboBox, is there a way to have a single module that can
detect which box made the change and then make the call?

A remember from doing some VB years ago that this was possible on forms
using the index number I think, but not been able to replicate this on
an Excel spreadsheet.

Can anyone help?


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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Change event for comboBox

hm - if i understand your question, i think you're asking about a 'god
function' you can call to populate the box ..

what you'll want to do is create a new class module (right click on
modules, and then pick class module). and then put your code there in a
function. for each place you want to populate the drop down box - just
"call myFunction"

Public Function myFunction
<put your code here
End Function

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 258
Default Change event for comboBox

Hi,

you need a class module that will catch the events. You have to connect
(instantiate) each combobox to this class module (preferably store
these connections in a collection).

See help for application events - not exactly what you need, but will
point you in right direction.

You class module should from the start look like:

Option Explicit

Public WithEvents evtCombo As ComboBox

Let me know if you need more help.

Regards,
Ivan

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Change event for comboBox

You can adapt this approach to do it.

http://www.j-walk.com/ss/excel/tips/tip44.htm

--
Regards,
Tom Ogilvy



"cmpcwil2" wrote:


Hi,
I have multiple VB toolbox comboBox's on a Excel spreadsheet, when a
selection change occurs it makes a call to a webservice to populate
adjacent cells with the returned data.

At the moment I have simply copied and pasted the code into each change
event for each ComboBox, is there a way to have a single module that can
detect which box made the change and then make the call?

A remember from doing some VB years ago that this was possible on forms
using the index number I think, but not been able to replicate this on
an Excel spreadsheet.

Can anyone help?


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


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Change event for comboBox


Thanks for your help I will take a look and give it a go, really do
appreciate it


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



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
Combobox change event only by UI Excelerate-nl Excel Programming 0 May 2nd 06 04:05 PM
MsgBox in Enter event causes combobox not to run Change event Richard Excel Programming 0 March 6th 06 02:52 PM
Combobox on change event Matt Jensen Excel Programming 4 December 29th 04 04:37 PM
Change minimumscale with the change event of a combobox Herbert Chan Excel Programming 1 April 11th 04 12:43 PM
combobox change event scrabtree23[_2_] Excel Programming 3 October 20th 03 05:56 PM


All times are GMT +1. The time now is 02:05 AM.

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"