Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Listbox Question | Excel Discussion (Misc queries) | |||
Listbox Question | Excel Worksheet Functions | |||
ListBox Question | Excel Programming | |||
listbox.value not equal to listbox.list(listbox.listindex,0) | Excel Programming | |||
Listbox question | Excel Programming |