Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 336
Default List Box Change Event

Hi,

I have a list box and have the following code in the worksheet module:

Private Sub MyListBox_Change()
Sheets("Report").Select
End Sub

My list box is called MyListBox but when I select it nothing happens. All I
want is to go to another sheet after the change occurs.

The only thing I can think is the name of my list box is incorrect but it
does show as MyListBox in the cell name drop down but it doesnt appear in the
defined names. Using 2003.

Can anyone see what I am doing wrong?

Thanks in advance

Martin
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 834
Default List Box Change Event

What sort of ListBox is it, from the Forms toolbar, or the Control tollbox?

If it is the former, you need to assign a macro, right-clickAssign Macro,
that does the sheet select. If if is the latter, you can add that code to
the worksheet's code module.


---
HTH

Bob Phillips



"Martin" wrote in message
...
Hi,

I have a list box and have the following code in the worksheet module:

Private Sub MyListBox_Change()
Sheets("Report").Select
End Sub

My list box is called MyListBox but when I select it nothing happens. All
I
want is to go to another sheet after the change occurs.

The only thing I can think is the name of my list box is incorrect but it
does show as MyListBox in the cell name drop down but it doesnt appear in
the
defined names. Using 2003.

Can anyone see what I am doing wrong?

Thanks in advance

Martin



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default List Box Change Event

Maybe you meant this:

Private Sub ListBox1_Click()
Sheets("Report").Select
End Sub

--
Regards!
Stefi



€˛Martin€¯ ezt Ć*rta:

Hi,

I have a list box and have the following code in the worksheet module:

Private Sub MyListBox_Change()
Sheets("Report").Select
End Sub

My list box is called MyListBox but when I select it nothing happens. All I
want is to go to another sheet after the change occurs.

The only thing I can think is the name of my list box is incorrect but it
does show as MyListBox in the cell name drop down but it doesnt appear in the
defined names. Using 2003.

Can anyone see what I am doing wrong?

Thanks in advance

Martin

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default List Box Change Event


The change function need to be in the VBA sheet where box is located. I
usually add a break point in the macro to make sure the event is
occuring properly by selecting a line of code in the macro and hitting
F8. The code will no work unless the application.enableevents is set to
true.


--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=162267

Microsoft Office Help

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 489
Default List Box Change Event

Are you actually changing something in the list box or are you just selecting
the list box. If you are just selecting the listbox I would use the
MyListBox_Click Event.

If you are changing something in the list box try:

Private Sub MyListBox_Change()
Sheets("Report").Activate
End Sub

or

Private Sub MyListBox_AfterUpdate()
Sheets("Report").Activate
End Sub
--
Cheers,
Ryan


"Martin" wrote:

Hi,

I have a list box and have the following code in the worksheet module:

Private Sub MyListBox_Change()
Sheets("Report").Select
End Sub

My list box is called MyListBox but when I select it nothing happens. All I
want is to go to another sheet after the change occurs.

The only thing I can think is the name of my list box is incorrect but it
does show as MyListBox in the cell name drop down but it doesnt appear in the
defined names. Using 2003.

Can anyone see what I am doing wrong?

Thanks in advance

Martin



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 336
Default List Box Change Event

Hi,

I have tried all suggestions but it still doesnt want to work. Not sure
where to go from here, will have to think of other options...

Martin


"Ryan H" wrote:

Are you actually changing something in the list box or are you just selecting
the list box. If you are just selecting the listbox I would use the
MyListBox_Click Event.

If you are changing something in the list box try:

Private Sub MyListBox_Change()
Sheets("Report").Activate
End Sub

or

Private Sub MyListBox_AfterUpdate()
Sheets("Report").Activate
End Sub
--
Cheers,
Ryan


"Martin" wrote:

Hi,

I have a list box and have the following code in the worksheet module:

Private Sub MyListBox_Change()
Sheets("Report").Select
End Sub

My list box is called MyListBox but when I select it nothing happens. All I
want is to go to another sheet after the change occurs.

The only thing I can think is the name of my list box is incorrect but it
does show as MyListBox in the cell name drop down but it doesnt appear in the
defined names. Using 2003.

Can anyone see what I am doing wrong?

Thanks in advance

Martin

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default List Box Change Event

Check the name of your listbox in the properties window! It should be
MyListBox. If you create a new listbox, then Excel2003 gives it a name
ListBox1. MyListBox reminds me to the word usage of VBA Help. Maybe you
copied your code from there?
--
Regards!
Stefi



€˛Martin€¯ ezt Ć*rta:

Hi,

I have tried all suggestions but it still doesnt want to work. Not sure
where to go from here, will have to think of other options...

Martin


"Ryan H" wrote:

Are you actually changing something in the list box or are you just selecting
the list box. If you are just selecting the listbox I would use the
MyListBox_Click Event.

If you are changing something in the list box try:

Private Sub MyListBox_Change()
Sheets("Report").Activate
End Sub

or

Private Sub MyListBox_AfterUpdate()
Sheets("Report").Activate
End Sub
--
Cheers,
Ryan


"Martin" wrote:

Hi,

I have a list box and have the following code in the worksheet module:

Private Sub MyListBox_Change()
Sheets("Report").Select
End Sub

My list box is called MyListBox but when I select it nothing happens. All I
want is to go to another sheet after the change occurs.

The only thing I can think is the name of my list box is incorrect but it
does show as MyListBox in the cell name drop down but it doesnt appear in the
defined names. Using 2003.

Can anyone see what I am doing wrong?

Thanks in advance

Martin

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
What event is associated with a CHANGE in a validation list box? [email protected] Excel Programming 3 April 2nd 07 08:02 PM
In what version was the change event on a data validation list fixed? Don Wiss Excel Programming 1 May 5th 06 12:55 PM
Worksheet Change Event With Validation List Kris_Wright_77 Excel Programming 5 January 24th 06 05:41 PM
Sheet change event and list validation question Nick Excel Programming 1 October 21st 04 01:20 PM
Change Cell from Validated List Not Firing Worksheet Change Event [email protected] Excel Programming 3 October 4th 04 03:00 AM


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