Populate ComboBox With Named Range

Jan 9, 2007

I use


Set rnData = ActiveSheet. Range("ProductList")
vaData = rnData.Value

With Me.model
.Clear
.List = vaData
.ListIndex = -1
End With

to populate a combobox list. 'ProductList' is a Dynamic Named Range with the definition

=OFFSET(Stock_List!$L$2,0,0, COUNTA(Stock_List!$L:$L)-1,1)

The '-1' allows for a heading at the top of the column.
This works fine when the list in col. L has more than one entry under the heading. But with only one entry I get 'Runtime error 381 - Could not set the List property, Invalid property array index' and the debug highlights on


.list=vaData

View 9 Replies


ADVERTISEMENT

Excel 2007 :: Populate Userform Combobox With Named Dynamic List

Aug 21, 2014

Excel 2007 and very new to VBA...

I have a userform (named "QAReviewForm") with a combobox (named "cboSupName"). I want it to populate with my named range "SupList".

FYI, the SupList is found on sheet 2, "Administrative Menu" in column E. E1 contains the heading "Supervisors", and my named range formula is

Formula:

[Code ] .....

When it runs, my form opens and the combobox is there, but nothing appears as options for me to select (yes, I have some values in column E).

View 11 Replies View Related

Combobox With Named Range

May 23, 2007

'i use a combobox in a userform to show data from a hidden sheet its name is sheet5(sheet1).
'i defined the Range as ExpCat and put ==OFFSET(Sheet1!$M$3,0,0, COUNTA(Sheet1!$M3:$M9),1)
'and use this code to view the data, but the code shows the data of the activesheet.

Private Sub ComboBox1_Click()
Me.ComboBox1 = ThisWorkbook.Worksheets(5).Range("ExpCat").Value
'Me.ComboBox1 = ThisWorkbook.Sheet5.Range("ExpCat").Value

End Sub

View 9 Replies View Related

Populate / Fill Combobox From Range Name?

Feb 22, 2008

I have a userform (uf_PaxInput) with a Combobox (cmb_flight_dest) which I am trying to populate from a worksheet range ("Dest") using the following code:

VB:
Sub LoadForm()
With uf_PaxInput.cmb_flight_dest
For Each Item In Range("Dest")
.AddItem
Next Item
End With
uf_PaxInput.Show
End Sub

The code seems to run okay however whent the form loads the combobox drops down to show only blank items to select. These blank items number them same number of items that are in my named range ("Dest").

View 6 Replies View Related

Populate Combobox With Range Names

Aug 15, 2007

All I want to do is
put a combo box on a spreadsheet,
have it populated, and sorted - ideally, alphabetically with range names already created.

And

I'd like to be able to click on the Range Name and GoTo the location.

View 9 Replies View Related

Populate Combobox With 2 Column Range

Jul 11, 2007

I would like to populate a combobox with text from two different ranges:

I have an ID No in column A (range = ID)
and a descripton in Column B (range = Description)

I would like the following to appear in the combobox:

"J.034 Kitchen Bench"
at the moment I can only get J.034 from the following
Private Sub UserForm_Initialize()
Dim cBase As Range
Dim ws As Worksheet
Set ws = Worksheets("Matdata")
For Each cBase In ws.Range("ID")
With Me.cboBase
.AddItem cBase.Value
.List(.ListCount - 1, 1) = cBase.Offset(0, 1).Value
End With
Next cBase
Me.cboBase.SetFocus
HideTitleBar Me
End Sub

View 9 Replies View Related

Populate Cells With Named Range Values

Oct 2, 2008

I want to run a macro when a cell is changed and populate Cell A12 With
the value in a named range.

The Name of that range is in cell A3

so i assumed i could do the following:

View 7 Replies View Related

Populate Cells Using Dynamic Named Range VBA

Sep 25, 2011

I have a sheet containing 2 lists of categories for income and expenses. These lists are named inc and exp, respectively, and are contained in a sheet called "Lists." They are dynamic ranges, meaning every time a value is added, the named range adjusts itself to include the new value(s). [=OFFSET(Lists!$A$1,0,0,COUNTA(Lists!$A:$A),1)]

I have 2 tables summarizing 12 months of data. The tables use sumif to find all occurrences of each category and sum them. There's 1 table for income, 1 for expenses. Each is a 2 column table, with all the categories for income in column A and their total for 12 months in column B. Same for Expenses in D & E.

To populate the categories in column A & D, I am currently using the simple =Lists!A1 =Lists!A2 (inc range), =Lists!B1 =Lists!B2 (exp range) and so on... the problem is when a value is added to either list, while the named range adjusts, I have to manually drag the formulas in Column A & B down 1 more cell to include the new value.

How can I use VBA to look for the inc and exp ranges (which will change in size), then populate each table with the most recent categories?

View 9 Replies View Related

Connecting Named Range With ComboBox?

Jun 16, 2014

I want to make simple Combobox with two dropdown lists throwing me back cells values, but I never made that so I've got a little difficulties.

The sample combobox should look like this:

Clipboard01.png

For the left Dropdown list there's defined name of the range "ITEM1", and for the second - range named "ITEM2".

After user will choose something I want to have numbers of the items selected from the lists in cells "A1" and "A2", and run a macro after clicking OK. How can I do this?

View 1 Replies View Related

Populate Userform Combobox From Range In Different Workbook

Jul 28, 2012

I am looking to fill out a combobox (say combobox1) in a userform from a set of ranges located in a different workbook (that is in a different location).

For example, the cells that would need to be in the combobox are B5:B41,D5:D40 and F5:F45 and the file location is W:WCWORKCENTERS.xls

View 3 Replies View Related

Populate ComboBox And TextBox With Horizontal Range?

Nov 14, 2012

I've done define name to read column C until G in 1st row, N define another name from column C until G in 2nd row.For example; NameRanges for "Year" =OFFSET(Sheet2!$C$1,0,0,1,COUNTA(Sheet2!$1:$1)-2), for
"Thickness" = OFFSET(Sheet2!$C$2,0,0,1,COUNTA(Sheet2!$2:$2)-3)

I want to display list of year in combobox and then, when the user click on the first item in combobox, the textbox will display the value that correspond to the combobox. For example; when the user click Year = 1990 in the combobox, the textbox will take value from excel and display thickness for year 1990 which is 4.

This is my code, the code in UserForm_Initialize is working. unfortunately, coding to display value in TextBox1, doesnt work.

VB:
Private Sub UserForm_Initialize()

Dim rngYear As Range [code].....

View 9 Replies View Related

Automatically Populate Combobox With The Data In A Certain Range

Mar 12, 2009

I would like to know how to automatically populate a combobox with the data in a certain range. Attached is a simple workbook with the example. I know how to do this with the additem. But I dont know how to create the array or userform initialize to populate the combobox with the range.

View 3 Replies View Related

Populate Combobox In VBA With Only Filled Cells From A Range

Nov 2, 2013

I have a combobox on a spreadsheet it is populated on a sheet called teams :

The Format control has an input range of: Teams!$B:$B

Now this has a few thousand empty cells in the range but I would need it to only populate with the cells that are not empty.

View 3 Replies View Related

Populate A Forms Listbox From Another Workbooks Named Range?

Feb 17, 2007

How can i populate a forms listbox from another workbooks named range? ....

View 9 Replies View Related

ComboBox Add Entry To Named Range If Not In List

Feb 4, 2014

I am trying to work up a referral tracker for my wife's employer. I have Named Ranges on sheet 2, a running log on sheet 1. I also have a userform that is being populated from the ranges on sheet 2. I have the project mostly functional, except for a feature I would like to add in. I am interested in adding to the named range that is being accessed if the entry is not in list, via the combobox1 on the userform. Also, if possible, I would like the list to re-sort behind the scenes so the added entry is properly located in A-Z format for next time. After searching the web a bit, I found some code that might work with some tinkering, but currently I am having issues with it. Here is the bit I am trying to use.

[Code] ....

I have been getting 424 Object Errors and a few others as I continue to mess with this. I am also attaching the project if someone may see a better way of getting the task accomplished. The overall scope of this is to log all referral sources so monthly and yearly reports could be made.

Attached File : Copy of Referal Tracker.xlsm‎

View 3 Replies View Related

Populate Userform Combobox With Unique Values From A Range

Jul 26, 2012

I found this thread which deal with populating unique values in my listbox.

Here is the thread link. [URL] ........

What these line of code mean (the ones in red).

Code:
Private Sub UserForm_Initialize()

Dim v, e
With Sheets("maintenance").Range("c2:c500")
v = .Value
End With
With CreateObject("scripting.dictionary")

[Code] ......

Note : I simple tried to check the value of v by giving msgbox (v), just below the line v = .Value.

But I got run-time error 13 : Type mismatch error.

View 5 Replies View Related

Populate ComboBox With Specific Sheet Column Range

Mar 4, 2008

I am attempting to populate a ComboBox ( named "SRnumber2") on a userform (named "UpdateSR"), but have hit a brick wall. The following testing code was working but now it is not:

Private Sub UpdateSR_Initialize() 'This section of code initializes the drop-down boxes.

'Add list entries to SR Number combo box. The value of each
'entry matches the existing SR Information spreadsheet entries in column "A"

Sheets("SR Information").Select

SRnumber.ColumnCount = 1
SRnumber.RowSource = "A2:A200"
SRnumber.BoundColumn = 0 ...........

View 9 Replies View Related

Have Output Cell Of ActiveX Combobox Link To Named Range?

Apr 22, 2013

=AVERAGEIFS(MFI,DATE,">="&JanStart,DATE,"<="&JanEnd)

MFI is the named ranged that is referencing a column of data. This works, but I want to be able to change the MFI to a different named ranged.

So what I am trying to do is using an ActiveX Combo box so I can reference the named ranges that I have set, for example MFI, so each time a user chooses MFI or another named range, it will output to a linked cell (A1). Then the linked cell will be referenced into this forumla.

=AVERAGEIFS(A1,DATE,">="&JanStart,DATE,"<="&JanEnd)

Is it possible for A1 to be linked to the named range, so if the user choses MFI in the combo box, it will change all AverageIFS formulas to look at a different named range.

View 3 Replies View Related

Add Dynamic Named Range To Combobox In Userform - Runtime Error

Oct 8, 2013

I'm trying to add a dynamic named range to a combo box in Userform but getting this error.

Have tried several lines of code this being the last that hasn't worked . . . .

Code:
CustCBx.RowSource = Range("CustList").Value

This is the formula for the named range in sheet

Code:
='Customer Info'!$J$2:INDEX('Customer Info'!$J2:$J200,COUNTA('Customer Info'!$J2:$J200))

View 1 Replies View Related

Excel 2007 :: VBA Auto-populate ComboBox With Range Of Data In Spreadsheet

Sep 20, 2012

I'm trying to get some vba to automatically find the range of data in a spreadsheet (So start from a specified point and loop until it's blank) and populate a combobox with this range accordingly. I have read numerous articles and posts but nothing seems to work!!

I am using Excel 2007.

View 5 Replies View Related

Copy Named Range Data To Worksheet Based On Dropdown Or Combobox

Feb 10, 2013

I have a worksheet called "Lookup" with several dynamic named ranges (each is 1 column wide) including facility, department, shift, etc. On a summary worksheet in the same workbook I want users to use a dropdown or combo box (don't care what type) in cell B2 to select a facility and then based on their selection, copy the department named range data and paste it into the summary sheet beginning in cell A5 and paste the shift named range data into the summary sheet beginning in cell B5.

Example: user selects "AR Plant" from the dropdown or combo box and the data from the "AR_Rpt" named range is pasted into cell A5 and the "AR_Shift" named range is pasted into cell B5.

View 9 Replies View Related

Combobox Addition To Rowsource In Dynamic Named Range Corrupting Table

Aug 10, 2014

My Userform with combobox entries for product checks against the rowsource and if not on the list, is added to the list. the list is a named range in a Table that is used in a data model.

No matter which way I try I am regularly getting a corruption in the table that is home to the named range which is the rowsource... after one or two entries from the userform.

The rowsource is not bound to the worksheet, it is populated at userform_initialize procedure. (There are 4 combobox drawing from same rouwsource hence the loop through to check each)

debug points to the line at which conbobox value is being entered into the rowsource, though not always - it sometimes just crashes the whole file and everything needs restarting, upon which the table is fine and entry is evident.

I have tried resize, addrow to bottom of table variations and all result in the same core problem of a table corruption that crashes the file.

View 4 Replies View Related

Auto Populate 2nd Combobox Based On 1st Combobox Data

Mar 30, 2014

I need to populate two combo boxes from excel sheet, the data will be like below:

Column A Column B
A 1
A 2
A 3
A 4
A 5
B 100
B 101
B 102

So from the above data, one combo box should hold unique values A & B.

On selecting a value from the 1st combo box A or B, respective values should be populated in 2nd combo box.

So the data should be like below:

If A is selected in the 1st combo box, then 2nd combo box should only show the values 1,2,3,4 & 5.
If B is selected in the 1st combo box, then 2nd combo box should only show the values 100,101 & 102.

Friends I need it in a macro and one important point is, this is dynamic and it is not static and the data can be more.

View 1 Replies View Related

Populate Combobox Based On Selection Of Other Combobox

Jun 12, 2006

I have a table, headers "FirstName" and "SurName".

Further a Userform with 2 Comboboxes "FirstName" and "SurName"

I'd like to choose the FirstName (say Jack) in the "FirstName" combobox, and based on that get the choice of the Surnames of all my Jacks in the "SurName" combobox.

Actually my sheet has much more fields and comboboxes, but i think my problem is just that I do not find a way to populate them dynamically.

View 9 Replies View Related

Determining If Cell Is Part Of Named Range And What That Named Range Is?

Aug 16, 2014

Let's say you have a named range, Rng1, which consists of cells A1 & A2. In vba how would you report back what, if any, named range the following cells resides:

Code] .....

here are multiple named ranges so using intersect is not feasible. Essentially, through code, I will be given a range and I need to determine if that range if part of a named range.

View 5 Replies View Related

Populate A Combobox In A Userform

Oct 22, 2007

I want it to populate a combobox in a userform. Should it go in the code segment for the userform, in a module, or some other place? The following is code I originally found (by Leith Ross of this board) to find the last row in column "A", and load the combo box "ComboBox1"

View 3 Replies View Related

Populate A Combobox From Data

Jan 26, 2009

able to populate a combobox from data elsewhere in the workbook as follows:

View 7 Replies View Related

Populate Textbox From A Combobox ()

Jul 3, 2009

It's a customer form where I need the contact person (txtContact) to be filled out when selecting the customer (in the cboCustomer).

The data is listed on the sheet "Customer", where all the customer names are in column from B2. The contact names are from C2 in the same sheet.

I have made a list in the namemanager called Contactlist (=OFFSET(Customer!$C$2;0;0;COUNTA(Customer!$C:$C)-1;1)

I have this VBA for getting the customer to the cbobox

View 9 Replies View Related

Populate ComboBox In VBA With Data

Jan 15, 2013

I have created a combobox1 and I have written a code to populate the box the problem is when I run the form and select the data from the dropdown list it gives me an error. I can see the data but just can't select it. I have a command button that I use to save the data I select and insert it into fields on my worksheet. All I just need the drop down box to let me select the data I chose below is my code.

Private Sub ComboBox1_Click()
ComboBox1.Value = .Range("A2:A14")
End Sub

View 2 Replies View Related

Populate Based On Combobox Value

Jun 27, 2014

i would like to create a vba that will populate based on the comboboxes value

like this code

Code:
'for cmb1
'if cmb1 = major 1 then
'if range"F4" is empty then
'copy sheet1 range"A5:R5" to sheet2 range"F4"
'if cmb1 = major 2 then
'if range"F4" is empty then
'copy sheet1 range"A16:R16" to sheet2 range"F4"

[code]....

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved