Newbie Help

A

ARB

When i make a userform with listbox ... i want to load default values
that if the user just hits the button, any values he didn't change get
loaded into the appropriate cells. Any value he changes will overwrite
the default.

Problem is i am getting erratic results with the following:

If the user "tabs" through the fields... all is well...

If the user just hits the button... only some of the values are
updated... others are null/empty.

And to top it off, it seems Inconsistant as to which of the six values
are updated.

I'm probably just overlooking something simple, and any help would be
appreciated.

Andrew Blair
---------------------------------------
sample code follows:
---------------------------------------


Private Sub CommandButton1_Click()
Range("a1") = ListBox1.Value
Range("a2") = ListBox2.Value
Range("a3") = ListBox3.Value
Range("a4") = ListBox4.Value
Range("a5") = ListBox5.Value
Range("a6") = ListBox6.Value

End Sub

Private Sub UserForm_Click()

End Sub

Private Sub UserForm_Initialize()
ListBox1.List = Array("a", "b", "c")
ListBox2.List = Array("1", "2", "3", "4", "5", "6", "7", "8", "9",
"10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20",
"21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31")
ListBox3.List = Array("03", "04")
ListBox4.List = Array("1", "2", "3", "4", "5", "6", "7", "8", "9",
"10", "11", "12")
ListBox5.List = Array("1", "2", "3", "4", "5", "6", "7", "8", "9",
"10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20",
"21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31")
ListBox6.List = Array("03", "04")

ListBox1.Text = "a"
ListBox2.Text = "20"
ListBox3.Text = "03"
ListBox4.Text = "5"
ListBox5.Text = "2"
ListBox6.Text = "03"
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top