LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Junior Member
 
Posts: 7
Default Excel vba UserForm Lists not registering default values?

Hi,

I have 3 lists on my UserForm, all initiated as follows:

List.Clear
With List
.addItem "a"
.addItem "b"
etc.
End With

At the very end, I have:
List1.Value = "a"
List2.Value = "b"
List3.Value = "c"

Msgbox List1.Value & List2.Value & List3.Value

Currently List2.Value returns a blank - I've also had it switch to List1 being blank between loads (no code touched, just saving, exporting to test the form, and exiting before going back in)
EDIT: After running it repeatedly without exiting, I find that it just seems to randomize between which ones show up at all even without exiting...

However, it registers the default value of the list selection - whichever value I set those lists to is what the list starts off having selected. It just doesn't seem to want to show the value in the Msgbox, and subsequently, anything I try to use that initial value in.

Any clue what's going on?

Exact Code:
Code:
Private Sub UserForm_Initialize()

    ListBox1.Clear
    ListBox2.Clear
    ListBox3.Clear

With ListBox1
    .AddItem "a"
    .AddItem "b"
    .AddItem "c"
End With

With ListBox2
    .AddItem "a"
    .AddItem "b"
    .AddItem "c"
End With

With ListBox3
    .AddItem "a"
    .AddItem "b"
    .AddItem "c"
End With

ListBox1.Value = "b"
ListBox2.Value = "c"
ListBox3.Value = "a"

MsgBox ListBox1.Value & ListBox2.Value & ListBox3.Value

End Sub

Last edited by r1024768 : April 2nd 13 at 11:58 PM Reason: Added code + update
 
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
Registering parameter/function help for Excel User Defined Functio Jack Hoxley [MVP][_2_] Excel Programming 5 August 28th 08 10:13 AM
Multiple lists with repeated values for dependet drop down lists mcmanusb Excel Worksheet Functions 1 September 29th 06 12:13 AM
Create Outlook Distribution lists (default txt file) with excel nicolascap Excel Programming 5 March 3rd 06 04:36 PM
registering the cell values of excel combo box associated values john_stevens Excel Programming 1 May 21st 04 09:39 PM


All times are GMT +1. The time now is 01:51 AM.

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"