I also have attached it so you can view. This form is not large, but it seems to take awhile to open, can someone look at the code and tell me if something in the code is causing this?
Private Sub UserForm_Initialize() Dim cNam As Range Dim cRea As Range Dim cLin As Range Dim ws As Worksheet Set ws = Worksheets("LookupLists") For Each cNam In ws.Range("LeadList") With Me.cboName .AddItem cNam.Value End With Next cNam For Each cRea In ws.Range("ReasonList") With Me.cboReason .AddItem cRea.Value End With Next cRea For Each cLin In ws.Range("LineList") With Me.cboLine .AddItem cLin.Value End With Next cLin Me.txtDate.Value = Format(Date, "Medium Date") Me.txtDate.SetFocus End Sub
Also, where would you put code to add a calendar drop down, if that is possible?
Last edited by 00Able; 11-27-2010 at 08:08 PM.
Your one named range is 65536 rows long.
Use this to populate the Line Lead ComboBoxRight click on the Tool Box,select add additional controls, see if You can find Microsoft Date and Time Picker. Click it to add to your tool box.'------------------------------------------- Dim LstRw1 As Long, r As Range LstRw1 = ws.Cells(Rows.Count, "A").End(xlUp).Row Set r = Range(ws.Cells(1, 2), ws.Cells(LstRw1, 1)) cboName.List = r.Value '-----------------------------------------------
Last edited by davesexcel; 11-27-2010 at 02:03 AM.
where do I place that at in the code? Also I have microsoft 2010 and I do not see the "Microsoft Date and Time Picker"
I wouldn't use the DatePicker control, it can be problematical - it's not always available on other users'PCs & from Office 2010 it is no longer available.
See the alternatives herehttp://excel-it.com/free_addins.htm, I generally recommend the ComboBox example
Hope that helps.
RoyUK
--------
If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need
For Excel Tips & Solutions, free examples and tutorials why not check out my downloads
New members please read & follow the Forum Rules
Remember to mark your questions Solved and rate the answer(s)
replace
With thisFor Each cNam In ws.Range("LeadList") With Me.cboName .AddItem cNam.Value End With Next cNam
------------------------------------------- Dim LstRw1 As Long, r As Range LstRw1 = ws.Cells(Rows.Count, "A").End(xlUp).Row Set r = Range(ws.Cells(1, 2), ws.Cells(LstRw1, 1)) cboName.List = r.Value
Thank you to both of you for both of your assistance.
Hope that helps.
RoyUK
--------
If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need
For Excel Tips & Solutions, free examples and tutorials why not check out my downloads
New members please read & follow the Forum Rules
Remember to mark your questions Solved and rate the answer(s)
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks