Fill ComboBox With 2 Dimensional Array
I can set up a 2 dimensional array by using
array = Workbooks("Workbook.xls").Worksheets("Data"). Range("D_all")
as range D-all contains 2 columns and 20 rows
I can send that list to a combo box by using
Me.ComboBox1.List() = array
If I have ColumnCount set to 2 then both columns will be listed
If I have ColumnCount set to 1 then the 1st part of the array will be listed
But how do I list just the 2nd part of the array
View Complete Thread with Replies
Sponsored Links:
Related Forum Messages:
Fill Range From Multi-dimensional Array
I searched and found a few posts about transposing arrays into a range of cells, but none of them seemed to solve my problem. So, my problem is, I have a .Net assembly which provides various functions to allow Excel to access our Oracle DB stored procedures/tables, etc. This assembly is exposed via COM Interop. I call the GetSPINTypes() method, which returns me a list of type pairs (ID, Name), in a CSV string format. I split the CSV into rows, and then put each row into a 2-dimensional array. I then need to dump that array into one of my sheets in Excel, so I try to do the usual Range.Value = Array, but this sometimes tells me there is a type mismatch, and most times just doesn't fill the range. I've checked my arrays in the watch window, and they have definitely been filled in correctly, the values just don't appear when they are put into the sheet. See the code I'm using below:......
View Replies!
View Related
Fill & Rearrange Multi-dimensional Array From Another
I've got the folowing array's date1>company1>price >Company2>price >company3>price >enz Date2>company1>price >company2>price >enz enz. But these are not the array's that i need for a correlation that i want to make. Is it possible to transform the array's above to an array such as: Company>date1>price >date2>price >date3>price >enz
View Replies!
View Related
Creating A 2-dimensional Array From A 1-dimensional List
I've been a lurker on this forum for a long while and it's always been able to provide me with lots of excel tips, and for that I am grateful! But this time I have a question that I can't find the answer to here, or anywhere else on the web after a few hours of looking. As a note, I'm not very experienced with Excel, probably somewhere between novice and intermediate. What I need to create is a 2-dimensional array of data. The vertical (y-axis) are the tools, and the horizontal (x-axis) are the jobs. Where the y-axis and the x-axis intersect, will be the quantity of tools needed for that specific job. There are almost 1500 tools, and 100 jobs.
View Replies!
View Related
Fill Array With Userform ComboBox Names
Is it possible to count the number of comboboxes on a userform? Or better yet can I fill an Array with all the combobox names on a userform? I can count the controls on a userform but I'm trying to count just the comboboxes? Instead of all the labels and textboxes and frames. I would like to loop through them for validation instead of doing it by each one by itself!
View Replies!
View Related
Interpolate Two-dimensional Array
With a known X and Y, trying to solve for Z from a table. ie: IF a variable X is defined across a row, another variable Y defined down a column, the data field Z fills in-between. What do I need to use to interpolate for both X and Y to solve for Z?
View Replies!
View Related
Function For 2-dimensional Array
I am trying to write a public function that fills a table for a 2-dimensional array and am having trouble with my named ranges. The x-axis is based on years (range F2:O2) and the y-axis is a q_factor (range E3:E23) so the data range would be (F3:O23. The following outlines my logic: Public Function bondValue(years As Range, q_factor As Range, z As Double) Dim nRow As Long, nCol As Long Dim bondPort As Range nRow = q_factor.Rows.Count nCol = years.Columns.Count sumTau = 0
View Replies!
View Related
Summing In A Multi Dimensional Array
I've created an array that is 60 pairs of cells wide. Each row in the array represents a different account. The 60 pairs of cells contain up to 60 payments in a payment stream. The first cell of each pair may contain an amount of interest to be paid, or zero if the time band in which it was/will be paid is not within the time range that I'm evaluating. The second cell of each pair may contain a number between 1 and 10 representing the time band in which the interest will be paid, or zero if the payment date falls outside of the time bands. I need to be able to sum the interest to be paid in each time band for all of the accounts in my database. Is there an Excel function that I could use or will I need to write some VBA code to loop through each row?
View Replies!
View Related
Multi-dimensional Array Solution
I am currently using a macro which highlights keywords and associated page views from an array in my website stats spreadsheet. Now I need to take it to the next level: I want to use a multi-dimensional array to pull out any keywords that are duplicated, and display them at the top of my spreadsheet with the totaled page views next to them in a different color (red). Here is my existing Keyword highlighting Sub Highlight_Keywords() Dim vntWords As Variant Dim lngIndex As Long Dim rngFind As Range Dim strFirstAddress As String Dim lngPos As Long
View Replies!
View Related
Populating A Multi-dimensional Array
I have a spreadsheet which I will be adding to over time. I need a macro that will look for the last 10 rows and then pull together a summary table based on data from several of the columns on each of those rows. I've tried to go about this by using an array. The array will always be the same size (it will always be 10 by 11, i.e. EngineArray(10,11)-basically the same size as my summary table). I've also set Option Base 1. What I’ve got so far is below. It isn’t working properly though. To start with I was getting ‘type mismatch errors’. Now instead of reading the numbers from the selected cells into the array, it just changes all the cells I’m trying to read from to ‘TRUE’?
View Replies!
View Related
Data Type Of Coordinates Of 2-dimensional Array
I have a big array "DataArray" and want to access it: For i = 1 To 4 variable = DataArray(SourceArray(i)) Next i "DataArray" has two dimensions, so SourceArray has to consist of data like this: SourceArray(1) = 1,2 sourceArray(2) = 2,4 etc What data type does Sourcearray have to be? Integer doesnt seem to work, and DataArray doesnt like a string as coordinates. I have a workaround with two different arrays of integer for x and y coordinates, but this cannot be it.
View Replies!
View Related
Evaluate Multi-Dimensional Array Matrix
I'm trying to use VBA to do some matrix processing. I have successfully done matrix processing in the spreadsheet, but I'm looking to port the logic into VBA to more easily reuse central formulas and reduce the amount of code in the spreadsheet. The function shown below works. I had to hack around the variable declarations to eliminate processing/compile errors but it seems to function (no pun intended). While debugging I noticed that this function would seem to get called 4 times. I do have other modules running, although I don't think any other modules are affecting this. After some input from shg, I updated the variable declarations, but I'm getting an "Overflow" error reported. Sometimes (not always) a divide by zero also pops up. I do have the Msgbox for errors at the end, I haven't tried removing that part to see if the error reporting vanishes. I'm not sure 'hiding' error alerts is the best thing to do anyway...
View Replies!
View Related
Multi-dimensional Array Not Showing In Listbox
I have made the function below to return a variant multidimensional array. I pass the function an array of folder paths that I wish to search through looking at subfolders within that path where their name matches a search string that I pass to the function. eg., it will find a folder named "Catnap" if you pass the string searching for as "Cat*". The size of the array it builds depends on how many folders it finds that match the search string and so needs to be built dynamically. Hence, I believe it builds a 2 dimensional array horizontally and I transpose it at the end of the function. In each element I put the folder name that was found in the first dimension and the path to that folder in its second dimension. I have a 2 column listbox on a form that I set this array to. eg., Me.ListBox1.List = DirPaths("C:","Cat*",vbDirectory,100) This works fine and shows a list of folder items found by folder and path in the two columns of the listbox if there is greater than 1 search found. However, when the search only finds 1 then the listbox shows the folder name with the folder path in row 2 of the list box. (See below).....
View Replies!
View Related
Join Dynamic Multi-dimensional Array
the built in "Join" function can join all elements of a 1-dimensional array into a string with delimiter. Now, how do I do that with multi-dimensional array if I just want to join 1 dimension of it. For instance, I have: m = 10 n = 20 Redim my(m, n) 'assign values to array here... 'I want to join, say, my(5, 0 to n) only 'How to do that without declaring a new 1 dimension array? Also, I want to write a join sub/function to do the above for n-dimensional array, do I need to write each one for every number of dimension (1 sub for 2-dimension, 1 sub for 3 dimension, etc.)?
View Replies!
View Related
ComboBox Value To Fill Corresponding Cells
I have a spreadsheet dealing with orders made by customers and the delivery of the items they have ordered. When I have delivered the items to a customer I need to note down that their order has been delivered. I also need to enter the date on which it has been delivered. I have created a user form in which I select the order number of that particular order from a combobox and state whether or not it has been delivered, this is either a "yes" or "no" selected from another combobox. I then have to note the date in a text box on which the items were delivered. My problem is getting the answer "yes" or "no" and the date to fill in on the worksheet next to the corresponding order number.
View Replies!
View Related
Fill Combobox With All Available Fonts
I am trying to find a quicker way to populate a ComboBox with every possible font available to the user on their particular computer in a manner other than simply using a ton of .AddItem statements. Is it at all possible to get a user created ComboBox to essentially function the same way that the ComboBox for selecting font works normally? Or is it necessary to go through and add the statements myself? I am creating a interface to specify default settings, one of which is font.
View Replies!
View Related
How To Elegantly Fill A List / Combobox
I am using the method below to fill a list or combo box. It works but is slow when there are to many entries. Is there a more elegant way to do this? I heard there was a method using the Excel filter function that makes the whole procedure below not necessary....
View Replies!
View Related
Fill Textbox With Info From Combobox
I am trying to insert information from a combobox into a textbox. The issue I have is that the information in the combobox is generated by accessing a network folder and filling the combobox with the names of the various folders. The combobox only generates the first seven digits of the folder... Private Sub combobox1_DropButtonClick() Call ShowFolderInfo("j:Consultant ServicesState Projects") End Sub Sub ShowFolderInfo(folderspec) Dim index As Object Dim fs As FileSystemObject Dim folderObject As Folder Dim SubFolders As Folders.......................
View Replies!
View Related
Fill ComboBox With Worksheet Names
I have a form created, were the user can select up to three pairs of open worksheets for sheet subtraction, to see where Im going with, aka the big idea see here: Column Subtraction With Criteria Via Box & Produce Results In New Workbook What I dont know how to do, is get the form in the attached workbook to show all the available worksheets. Specifically, from the dropdown combo box, I would like it to list all open worksheet title in all open workbooks.
View Replies!
View Related
Fill Combobox With Month Names
I will preface with what I am trying to do. I want to populate a combo box with months. The list will be populated based on a the date range in a dataset, so all 12 months may not bee populated in the combo box. I want the months to be listed in the combo box with their text names displayed(Jan, Feb... Dec) but have their numerical values when selected (1,2... 12). I'm sure there is a way to do this, but for the life of me I can't find how. My initial thought was to assign a value to a specific list index, i.e. assign the value of listindex 6 as "Jun", but I can't figure out the syntax to do that. This doesn't work, but might give some insight into what I am trying to do form.combobox.ListIndex(6) = "Jun"
View Replies!
View Related
Fill Combobox From Multiple Worksheets
I have a combobox that I populate this way: ' Sets Names in ComboBox1 Contents With Worksheets("Sheet1") Set rng = .Range(.Cells(1, "A"), .Cells(Rows.Count, "A").End(xlUp)) End With With ComboBox1 .RowSource = rng.Address(external:=True) End With What I have are 4 sheets one of which has 3 columns that I need to combine into one "Master" drop down, is that possible? Sheet1 - Column A Sheet2 - Column A, B and C Sheet3 - Column A Sheet4 - Column A
View Replies!
View Related
Fill ComboBox Based On Selection In Another
I want to dynamically list items in combobox placed in excel sheet. I have a list of 10 values in a column in excel sheet. I have placed two comboboxes in the same sheet. Now depending on the first combobox selected value i want to list either all or only few values from the available 10 values.
View Replies!
View Related
Fill Textboxes In UserForm From ComboBox
I've been trying for hours to populate a textbox on a userform based on a combo box. I'm including a zip of my workbook to see. (don't laugh to hard at my code, like I said I'm green...:) When you select a mix design in my form I want the next six combo boxes to populate. The way I have it now is based on one of the many examples found here, (none of which have worked for me so far, but this one said "the simplest way to do this is......") And I get an error 425 - "Object not found". I've done searches based on the error but haven't found an answer.
View Replies!
View Related
Fill ComboBox With Only 1 Occurence Of Each Item
The ideal is I have a list which the use fills in, for sack of argument Goal 1, Goal 2, etc but I have a problem. This list which the user builds I want to appear in a combobox with is quite easy using the list function and naming the range. The problem I have is that Goal 1 or 2 can be in this list more than once, if it is at all possible I want or would like the Combobox to only show Goal 1 once and not twice or how many times it occurs. I require the Combobox just to show all Goals once no matter how many time they occur.
View Replies!
View Related
Fill UserForm ComboBox With Values In Range
I have created a User form with Combobox's, which in turn look up cell references in another sheet. In order to make maintainence of the combobox's as easy as possible I'd like the look up as many cells as possible, therefore anyone can easily add additional text to go into the user forms. However I don't want the blank spaces to show until something has been added.
View Replies!
View Related
Fill ComboBox Based On Item Chosen In Another
Not overly familiar with ComboBoxes but what I want to do is load a ComboBox with data based upon the selection of another ComboBox Please see attached example. ComboBox1 - I can get to load. ComboBox2 - I want to load but only those lines that match the above selection TextBox - Load with the data on row selected by ComboBox2
View Replies!
View Related
Fill Textbox Based On ComboBox Selection
There is a small command button in cell A11 that brings up the userform. I have a multi-tab user form the userform contains a number of combo boxes with an associated textbox right of each. I would like to populate the textbox based on the value selected in the combo box. For example when Ice Foot is selected (Type of Fast Ice) populate the textbox (txtFastIceEncoded) with the value of 6. These values are located on 'decode' sheet. I then want to take the four values and place them in the textbox 'txt_Tw_Tw_Et_DE_ai_group'. Ultimately I want the values to end up back in the worksheet 'Synoptic Ice Obs'. Perhaps there is a better way to do this than I am trying. I have poured through countless threads in this forum and have tried a number of these. I however always seems to run into some problem that I do not understand fully. I have included a copy of the workbook.
View Replies!
View Related
Fill ComboBox With Unique Values From Column
I need to create a drop-down (or a combo list) list based on a column in a separate worksheet (in the same workbook). The values in the column have many duplications, and I simply want the combo box to return a unique list. After trying this using various options like drop-down boxes, combo boxes etc it does not seem to work. A drop-down box will return a complete list (including all of the duplicates). In addition the drop-down was linked to a cell and the value returned to the cell was a number based on the position in the list when what I actually wanted was the text. For example - my list in Worksheet 2: PETS Cat Dog Dog Cat Horse Rabbit... In Worksheet 1 if I choose 'Dog' from my Combo box (or drop-down) along with showing all of the duplicates it returns '3', instead of what I want 'Dog' and no duplicates.
View Replies!
View Related
Fill Listbox Or Combobox On User Form `
I have been able to create a userform that allows users to fill out a form without the need to navigate throught the excel spreadsheet form that has been created. to further refine this I am trying to use either a list box or Combobox to display specific items for certain cells, ie Travel Method (Air / Rail / Other), or Department (Projects / Finance / Engineering / Admin etc). I can create these in a spreadsheet without to much problem, but sofar have been unable to get them to work in the user form.
View Replies!
View Related
Fill Combobox With Unique List Range
i have a list of surnames in column A in a spreadsheet i want to use this for the source of the combo box also i want this list to be unique and if the surname is not present i want to be able to put the name in the combo box and add it to the sheet
View Replies!
View Related
Fill ComboBox With Cells Meeting Criteria
Well, after reading "Best Practices", it looks like I've got lots to learn about Excel and VBA Hope I don't break too many rules. see code below. I have a form that uses a set of dynamically filled combo boxes. The difficulty I'm having is in filling the combo boxes with correct data when updating an existing record. As per the code below, the Activecell. offset(0, #) references in the "if" statement in the For..Next loop process correctly, but Activecell references that fill the combo boxes seem to behave like an absolute references to Row 1, which are the Column Names. I've tried creating an Activecell.offset(0, 0) before every fill combo box statement and then using Activecell.offset(i, #) to reference the relevant cells, but to no avail. Obviously, I'm missing something here... Private Sub cboUserName_change() Dim usrnam As String Dim found As Boolean Dim i As Integer Dim intRowCount As Integer usrnam = cboUserName.Value found = False If usrnam <> "" Then ActiveWorkbook.Sheets("Data").Activate Range("A1").Select intRowCount = Range("A1"). CurrentRegion.Rows.Count - 1 ................
View Replies!
View Related
Fill TextBox With Offset From ComboBox Choice
I'm trying to get my textbox in my userform to get its value from my combobox's value with an offset and its been giving me some trouble. This is what I got so far and it works with no offset Private Sub ComboBox1_Change() TextBox1.Value = ComboBox1.Value End Sub And this is what I got so far for an offset which doesn't work Private Sub ComboBox1_Change() For i = 1 To 43 TextBox1.Value = ComboBox1.Value.Offset(i, 1) Next End Sub
View Replies!
View Related
Fill Cells Matching ComboBox With TextBox
I have a userform with text boxes and a combobox referencing a named range in the spreadsheet. What I'm trying to accomplish is when I click on a name in the combobox, I would like the text I'm adding to this name to be on the same row. Currently a new row is created with all this information instead of being added to the existing row and I end up with duplicate names in the combobox.
View Replies!
View Related
Dynamically Set Combobox List Fill Range
I have a combobox whose list is filled with different ranges, on different sheets, selectable using option buttons. The code is shown below: Private Sub OptionButton1_Click() Dim ray Dim Last ray = Sheets("Trades").Range("B2:B500") If OptionButton1 = True Then With ComboBox1 .List = ray .ListIndex = 0 End With End If End Sub
View Replies!
View Related
Update Multiple ComboBox List Fill Ranges
in A1 there will be a box with LinkedCell set to A1 and ListFillRange set to B1:B5. I now want a similar box in A2, with A2 as LinkedCell. However, when I copy paste the box in A1, it still refers to A1 and B1:B5 (the last part is ok). I can easily change A1 to A2 by just changing it in the properties, but the thing is that I also need these boxes in A3:A100. Someone else helped me out by writing some code, but this is not working correctly yet, probably because I'm doing something wrong. Also, the ListFillRange might expand in the future. Therefor I would like to know if its possible to select the boxes in A1:A100 and change the ListFillRange to B1:B6 for all at once, or even have a piece of code attached to a command button that recognizes the expanded range and updates it. I couldn't attach the file because it was to big, therefor I uploaded it with yousendit: [url] So in short: I would like all the comboboxes in column E to be linked to the cell underneath and have and option to adjust the listfillrange. The same for column F, but for this one the listfillrange needs to be O8:O11.
View Replies!
View Related
Fill Form's Combobox With Filtered Range
i have a range name (9 columns) and i filter for a certain type (Shrub) and i would like to only fill the combobox (on a form) with the filtered selection...? myfilter = "Shrub" Range("testmaterial").AutoFilter Field:=2, Criteria1:=myfilter ComboBox1.RowSource = testmaterial
View Replies!
View Related
Fill UserForm ComboBox / ListBox With Variable List
i want to use a listbox or combobox on a userform with the values coming from column A in the MAIN sheet. what i need is if the colour i want is not there i type the new colour in it then adds the value to the end of values in coloumn A and too the list for the next time i use the userform. is it possible to do this and how?
View Replies!
View Related
Combobox Array Formula
I m trying a Combobox array formula Private Sub Combobox7_CLick() ActiveSheet.UnProtect With ComboBox7 Sheet1=Evaluate = INDEX {(D40:D249,MATCH (1,IF($A$40:$A$249=A3,IF($B$40:$B$249=B3,IF($C$40:$C$249=C3,IF($D$40:$D$249=D3,1)))),0))} ActiveSheet.Protect End Sub
View Replies!
View Related
Fill ListBox With TextBox Matches While Excluding Those Matching ComboBox Choice
I've created a macro that searches the active worksheet for a textboxvalue and copies all full and partial matches to a multicolumn listbox. However, I'd like to install some sort of filter that prevents registrations not containing the value in a combobox from making it into the listbox (so I'd actually like to search for registrations meeting two criteria, i.e. an advanced search). The macro I'm using is: Private Sub Query_Change() Dim vFound As Range Dim strFirstAddress As String On Error Goto ErrorHandle Set vFound = Cells.Find(What:=Query.value, After:=Cells(1, 10), _ LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False) If Not vFound Is Nothing Then strFirstAddress = vFound.Address I've attached the workbook I'm working on, in case I haven't made myself sufficiently clear in the above.
View Replies!
View Related
How To Put Data Into An Array From A Combobox
I'm trying to create a data entry form that uses comboboxes. I can populate the comboboxes with data from an excell sheet. There are 3 columns of data that are called to each combobox, and the list of data is the same in each combobox. When the chosen line is selected for each combobox I then want to pass all that data back to the excel sheet in the same column layout. I suspect this will need to be done with an array. Basically, I want to have five tasks with timing details that are done from Monday to Friday - these are listed in excel. I want each of these tasks to appear in each combo box (two columns in the combobox) so that the user can decide which task will be done on which day. Then the tasks are passed back to excel as a timetable. If it were 1 column I could do it but the second column is causing me grief. I suspect this will need to be done with an array.
View Replies!
View Related
ComboBox List To Read Values From An Array
How do I set a ComboBox list to read values from an array? I tried the following in VBA, but it didn't work.... ComboBox1.List = Array("January", "February", "March", “April”, “May”, “June”, “July”, “August”, “September”, “October”, “November”, “December”)
View Replies!
View Related
Fill Array By Looping Worksheets
I am trying to write code that will loop through one sheet, fill an array and then use that array to populate cells in another sheet. I have a sheet with group names in column A, then in column B through Column IV there are the members of that group. There may be no members in a group or every cell through Column IV could contain data. I need to loop through each row, one at a time, see if a cell contains data, if it does, put it in the array, if it's empty then the array is done for that row. I then need it to go to another sheet and dump that data, however, now it needs to drop it in five consecutive cells in a row, then drop to the next row for the next five cells, etc. Once this is done it then goes back to the first sheet, drops to the next row nad starts over. I know how to loop through the rows, I just am not sure how to fill an array using variables for rows and columns. i.e., I can't say fill array with b1 to b30 instead I have to say fill array with intRow,intFirstColumn through intRow, intLastcolumn.
View Replies!
View Related
|