Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Confused about the ListBoxes.

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Confused about the ListBoxes.

Hi

Showing the code used to populate the list boxes will enable us to see what
is happening.

Regards,
Per

"fishonspeed" skrev i meddelelsen
...
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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Confused about the ListBoxes.

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" skrev i meddelelsen
...
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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Confused about the ListBoxes.

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" skrev i meddelelsen
...
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" skrev i meddelelsen
...
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




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Confused about the ListBoxes.

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" skrev i meddelelsen
...
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" skrev i meddelelsen
...
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






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Confused about the ListBoxes.

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" skrev i meddelelsen
...
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" skrev i meddelelsen
...
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" skrev i meddelelsen
...
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
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
Listboxes C Brehm Excel Programming 4 January 9th 08 03:11 PM
listboxes Zaahir Excel Programming 1 January 16th 07 12:26 PM
listboxes [email protected] Excel Programming 2 March 30th 05 06:41 PM
listboxes [email protected] Excel Programming 3 February 22nd 05 04:01 PM
Listboxes 2 Denise Excel Programming 2 June 8th 04 06:39 PM


All times are GMT +1. The time now is 09:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"