Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / January 2008

Tip: Looking for answers? Try searching our database.

trouble loading a range into a comboBox

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Janis - 17 Jan 2008 05:37 GMT
Can you tell me why when I run this userform that it erases the values in the
range A1:A12?
The userform initialize procedure runs but it erases the values in the cells
A1:A12 and it doens't have the list in the comboBox but other than that it
runs.

Private Sub UserForm_Initialize()

ThisWorkbook.Worksheets("patients").Range("A1:A12") = Me.ComboBox2.Value
   
End Sub

And I ran it several times and get the same results.

What am I missing?
tnx,
Gary Keramidas - 17 Jan 2008 05:45 GMT
your telling excel to set the range A1:a12 = to the form's combobox value. if
the combobox is empty, range("A1:A12") will be empty.

Signature

Gary

> Can you tell me why when I run this userform that it erases the values in the
> range A1:A12?
[quoted text clipped - 12 lines]
> What am I missing?
> tnx,
Nigel - 17 Jan 2008 07:01 GMT
You are currently forcing an empty ComboBox value into A1:A12, even if you
reversed the assignment it would still not load the ComboBox......use the
following to achieve that.

Dim c As Range
ComboBox1.Clear
For Each c In Worksheets("patients").Range("A1:A12")
   ComboBox1.AddItem c.Value
Next c

Signature

Regards,
Nigel
nigelnospam@9sw.co.uk

> Can you tell me why when I run this userform that it erases the values in
> the
[quoted text clipped - 14 lines]
> What am I missing?
> tnx,
merjet - 17 Jan 2008 11:30 GMT
Try this.

Private Sub UserForm_Initialize()
   ComboBox2.RowSource= "patients!A1:A12"
End Sub

Hth,
Merjet
Janis - 17 Jan 2008 11:31 GMT
Nigel
Thanks for the answer.   It really is urgent.  Helped immensely.  :)

> You are currently forcing an empty ComboBox value into A1:A12, even if you
> reversed the assignment it would still not load the ComboBox......use the
[quoted text clipped - 24 lines]
> > What am I missing?
> > tnx,
Dave Peterson - 17 Jan 2008 15:33 GMT
Check your first post, too.

> Can you tell me why when I run this userform that it erases the values in the
> range A1:A12?
[quoted text clipped - 12 lines]
> What am I missing?
> tnx,

Signature

Dave Peterson

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.