PC Review


Reply
Thread Tools Rate Thread

Confused about the ListBoxes.

 
 
fishonspeed
Guest
Posts: n/a
 
      29th Apr 2008
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
 
Reply With Quote
 
 
 
 
Per Jessen
Guest
Posts: n/a
 
      29th Apr 2008
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


 
Reply With Quote
 
fishonspeed
Guest
Posts: n/a
 
      29th Apr 2008
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

>
>

 
Reply With Quote
 
Per Jessen
Guest
Posts: n/a
 
      30th Apr 2008
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

>>
>>


 
Reply With Quote
 
fishonspeed
Guest
Posts: n/a
 
      30th Apr 2008
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
> >>
> >>

>
>

 
Reply With Quote
 
Per Jessen
Guest
Posts: n/a
 
      30th Apr 2008
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
>> >>
>> >>

>>
>>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with Listboxes =?Utf-8?B?RGFuaWVs?= Microsoft Access VBA Modules 1 28th Jun 2007 08:20 PM
Listboxes is this possible =?Utf-8?B?UGhpbA==?= Microsoft Access Form Coding 1 11th May 2007 03:33 PM
Listboxes .add =?Utf-8?B?RWQgTGF3cmVuY2U=?= Microsoft Access Form Coding 0 2nd Oct 2006 07:22 PM
Confused Newbie - Very Confused:( Wizard Microsoft Access Forms 0 20th Oct 2005 10:37 AM
Confused, need valid logon for OE, confused.. Rob Windows XP General 1 3rd Nov 2003 02:15 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:11 AM.