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


Can anyone kindly help with the following?

I have a sub named Run_Channel_Reports which calls the
following routines
Select_DataType
Create_Reports

Select_DataType contains the line frmChannel.show and I
have created a userform with a single selection listbox.
There are no other controls on the form. The code behind
my Listbox click event is

Private Sub LstSheet_Click()

sRange = LstSheet.Value

Create_Reports

End Sub

The Create_Reports sub contains code to run a loop, after
this has finished (and this appears to work ok in that it
exits when it should) I've inserted the frm.hide event.
FYI the user form is called frmChannel.

However, the code is not working as expected. When I step
through, VBA gets to the frmChannel.hide line which is the
last line in my Create_Reports sub, gets to End Sub then

steps back to the LstSheet_click sub (but End Sub is
highlighted in yellow) and then steps to my
Select_DataType sub which contains the following only

Sub Select_DataType()

frmChannel.Show


End Sub

but again End Sub is highlighted so I presume it's not
activating the frmChannel.show

Then the code goes back to Run_Channel_Reports (as
expected) but highlights the Create_Reports line which I
would not expect it to do. I would expect VBA to carry
out the last few lines of Run_Channel_Reports which are

Worksheets(sRange).Select
Worksheets(sRange).ShowAllData

Worksheets("menu").Select

Reset_Screen:
With Application
.StatusBar = False
.DisplayAlerts = True
.ScreenUpdating = True
End With
End Sub

Can anyone help because I'm unable to work out whether
there's something dodgy with my loop although it seems to
work ok or if I've coded the LstSheet_Click sub
incorrectly or something else. I'm outta ideas so any
clues are kindly appreciated.

Many thanks
Jacqui
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default ListBox question

Seems like you have event procedures associated with your UserForm that are
interacting unpredictably with your subs. Do you have any code associated
with UserForm events that you haven't shared with us?

--

Vasant




"jacqui" wrote in message
...

Can anyone kindly help with the following?

I have a sub named Run_Channel_Reports which calls the
following routines
Select_DataType
Create_Reports

Select_DataType contains the line frmChannel.show and I
have created a userform with a single selection listbox.
There are no other controls on the form. The code behind
my Listbox click event is

Private Sub LstSheet_Click()

sRange = LstSheet.Value

Create_Reports

End Sub

The Create_Reports sub contains code to run a loop, after
this has finished (and this appears to work ok in that it
exits when it should) I've inserted the frm.hide event.
FYI the user form is called frmChannel.

However, the code is not working as expected. When I step
through, VBA gets to the frmChannel.hide line which is the
last line in my Create_Reports sub, gets to End Sub then

steps back to the LstSheet_click sub (but End Sub is
highlighted in yellow) and then steps to my
Select_DataType sub which contains the following only

Sub Select_DataType()

frmChannel.Show


End Sub

but again End Sub is highlighted so I presume it's not
activating the frmChannel.show

Then the code goes back to Run_Channel_Reports (as
expected) but highlights the Create_Reports line which I
would not expect it to do. I would expect VBA to carry
out the last few lines of Run_Channel_Reports which are

Worksheets(sRange).Select
Worksheets(sRange).ShowAllData

Worksheets("menu").Select

Reset_Screen:
With Application
.StatusBar = False
.DisplayAlerts = True
.ScreenUpdating = True
End With
End Sub

Can anyone help because I'm unable to work out whether
there's something dodgy with my loop although it seems to
work ok or if I've coded the LstSheet_Click sub
incorrectly or something else. I'm outta ideas so any
clues are kindly appreciated.

Many thanks
Jacqui



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
Listbox Question Greg B Excel Discussion (Misc queries) 1 March 9th 05 02:17 PM
Listbox Question Greg B Excel Worksheet Functions 0 March 9th 05 12:46 AM
ListBox Question Randal W. Hozeski Excel Programming 7 December 20th 03 09:59 PM
listbox.value not equal to listbox.list(listbox.listindex,0) ARB Excel Programming 0 October 22nd 03 12:46 AM
Listbox question Stuart[_5_] Excel Programming 1 August 21st 03 07:16 PM


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