Okay, I don't see that your code is adding anything to the list boxes. Are
you sure that it's the code that populates Listbox1?
If you are working with a UserForm use the code below to populate the list
boxes with sheet names. If your list boxes is on a worksheet you can not use
Sub UserForm_Initialize, but the code within the sub will work.
Private Sub UserForm_Initialize()
For sh = 1 To ThisWorkbook.Sheets.Count
Me.ListBox1.AddItem Sheets(sh).Name
Me.ListBox2.AddItem Sheets(sh).Name
Next
End Sub
Best regards,
Per
"fishonspeed" <(E-Mail Removed)> skrev i meddelelsen
news:3F820273-FBFB-4508-8DDE-(E-Mail Removed)...
> Their counting the sheets and placing the sheet names in a list that is
> then
> displayed in a list box. I'm just confused as to why one works while the
> other doesn't. The second one doesn't even execute. I've tried placing
> MsgBoxes in several places throughout the second procedure and nothing
> happens. The program completely skips that chunk of code.
>
> I dispise your poor English and inability to use punctuation correctly ...
> or at all.
> ~FishOnSpeed
>
>
> "Per Jessen" wrote:
>
>> Hi again
>>
>> I'm not sure what you are trying to to with this code part. What are the
>> variables refering to ?
>>
>> Regards,
>> Per
>>
>> "fishonspeed" <(E-Mail Removed)> skrev i meddelelsen
>> news:5B18939E-2C65-44D7-884C-(E-Mail Removed)...
>> > Ah. That is true.
>> > Here it is:
>> >
>> > With Me.ListBox1
>> > For ScreenCounter = 1 To .ListCount
>> > If .Selected(ScreenCounter - 1) Then
>> > ScreenTracker = ScreenTracker + 1
>> > mySheetNames(ScreenTracker) = .List(ScreenCounter - 1)
>> > Sheet(ScreenCounter) = mySheetNames(ScreenTracker)
>> > End If
>> > Next ScreenCounter
>> > End With
>> >
>> > With Me.ListBox2
>> > For ScreenCounter2 = 1 To .ListCount
>> > If .Selected(ScreenCounter2 - 1) Then
>> > ScreenTracker2 = ScreenTracker2 + 1
>> > mySheetNames2(ScreenTracker2) = .List(ScreenCounter2 -
>> > 1)
>> > Sheet2(ScreenCounter2) = mySheetNames2(ScreenTracker2)
>> > MsgBox (ScreenCounter2 & ScreenTracker2)
>> > End If
>> > Next ScreenCounter2
>> > End With
>> >
>> >
>> >
>> > --
>> > I dispise your poor English and inability to use punctuation correctly
>> > ...
>> > or at all.
>> > ~FishOnSpeed
>> >
>> >
>> > "Per Jessen" wrote:
>> >
>> >> Hi
>> >>
>> >> Showing the code used to populate the list boxes will enable us to see
>> >> what
>> >> is happening.
>> >>
>> >> Regards,
>> >> Per
>> >>
>> >> "fishonspeed" <(E-Mail Removed)> skrev i meddelelsen
>> >> news:E3AD2851-EAF1-48FC-AFCA-(E-Mail Removed)...
>> >> >I have two list boxes that should both show the exact same thing. So
>> >> >I
>> >> >used
>> >> > the exact same code for both boxes just with different variables
>> >> > that
>> >> > have
>> >> > the exact same values.
>> >> >
>> >> > The problem is that only the first list box shows anything. And even
>> >> > if
>> >> > I
>> >> > take the code for ListBox1 out and leave everything for ListBox2 in
>> >> > the
>> >> > selections still show up in ListBox1. If I have the code for both
>> >> > boxes
>> >> > written, the selections still only show in ListBox1 and ListBox2 is
>> >> > blank.
>> >> >
>> >> > Any ideas as to why this may be happening?
>> >> > --
>> >> > I dispise your poor English and inability to use punctuation
>> >> > correctly
>> >> > ...
>> >> > or at all.
>> >> > ~FishOnSpeed
>> >>
>> >>
>>
>>
|