Dynamically Select List Object Name?
May 13, 2013
I have a workbook with three sheets:
-"DB" database sheet containing multiple tables (20 to be exact, named as "CityA", "CityB", etc.)
-"Threat Data" reference sheet containing a "City_Ref" table with the list of tables names in the "DB City ID" column and the unique city name assigned to each table in the "City" column (the city name is populated in a "City" column of each table in the database sheet).
-a dashboard sheet containing an interactive userform for which to populate the database tables.
In this userform, there are two comboboxes:
-a "CbxCity" combobox which lists all the city names from a "City" column in the "City_Ref" reference table
- a "CbxAsset" combobox which should automatically list all the values in the "Asset" column of the selected city table based on "CbxCity"
My issue lies in filling "CbxAsset" based on the selection in "CbxCity" ; how do I dynamically select a ListObject name based on a selection?
The code I am working with is:
[Code] .....
In the CbxCity_Change() sub, I am not sure how to name the ListObject and my code currently gets an error at r = Me.CbxCity.Value
Which is strange because that is showing the selected city name when I run the cursor over the bug.
View 14 Replies
ADVERTISEMENT
Oct 7, 2007
I have a macro, it imports data from a text file and separates the data from the text file into columns. My issue is that it automatically picks a fixed filename. I would want to manually select a filename from different directories.
Below is my macro: ...
View 9 Replies
View Related
Apr 28, 2009
I need to apply a dynamic filter to my constantly changing list.
Here's an extract of the fields in Sheet "Materials". I need to filter by an of the Type Levels or by the "Index #" fields. The result would be used in another sheet. The return value should be a filtered list from the "Full Material Name" field.
Material IDIndex #Type Level 1Type Level 2Type Level 3Type Level 4Material NameFull Material NameM0000110010Class 0 - Raw MaterialsSection 0 - Metallic MaterialSheet & PlateGalvanized10gSheet & Plate - Galvanized - 10gM0000210010Class 0 - Raw MaterialsSection 0 - Metallic MaterialSheet & PlateGalvanized12gSheet & Plate - Galvanized - 12g
View 12 Replies
View Related
Jul 8, 2013
Let me explain, I am trying to auto generate a list. So I have one cell A1 with value "ABC"In another sheet,
I have a list of products in cells A:1 to A:100 and "ABC" is one of them, but is there 4 times. I have value in B:1 to B: 100
What I need is to create a list of all the values in Colum B that are related to "ABC"
Colum A Colum B
ABC 10
ABC 20
ABC Test
ABC TBD
Based on "ABC", I need a list to generate a list:
10
20
Test
TBD
I try Arrays and VLookup and Match and index but they are all single data return.
View 4 Replies
View Related
Jun 20, 2008
my file was too big to attach, so to get it, go to [url] (p: SOCIALCHARM [all caps]). It's the only file underneath the 'documents' section.
This is a complex sheet, so I won't go into everything I'm doing, but really just the part I need help with. Instead of trying to explain it abstractly, I'll use a a concrete example (you'll need to look at the sheet to understand this).
The general idea is that I results from an online ad campaign (ie I ran ad X on site Y in position Z), and - given the results I have - try to optimize which ads I run where. Each in the real data (row 167 and below) represents a 'space' where an add can be run.
First, row 551:
The original recommendation is in Column T, which is Brand "Buddies" (column V). The total # so far for brand "Buddies" (col W) is less than the limit, so Column X = 0, and the updated recommendation (Column Y) is just the original recommendation from Column T.
Now, row 552, (the condition I'm having trouble with)
The original recommendation is in Column T, which is Brand "Pink" (column V). The total # so far for brand "Pink" (col W), however, is now OVER the limit, so Column X = 1. This means that excel now needs to search all of the creatives (in column E), filter out all the ones that don't match the size of the current creative in question (ie that are not of size 300x250 - E551), ALSO filter out any creatives of brands that have already hit their limit (in this example, brand "2-in-1" has already hit it's limit, as you could check by looking at X537), THEN, from the remaining creatives (ie those of size 300x250 and not of brand pink OR of brand 2-in-1), select the creative with the highest value in Column AI).
View 3 Replies
View Related
Jan 15, 2012
I have to filter a data based upon the selection list value.
Ex:
Assume that i have 4 values listed in my SELECTION LIST
INDIA
US
UK
AUS
If i select "US" in selection list ...Filter has to take this dynamically and filter the data..
View 2 Replies
View Related
Jan 1, 2010
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 9 Replies
View Related
May 19, 2014
I have pulled a SharePoint list into my workbook. The list object (table) is still linked to the SharePoint list, as I'd like to synchronize it later on. I have filtered it with an autofilter. I'd like to delete all of the visible rows. I have tried a billion things to no avail. I have been searching Google for hours now. None of the examples work.
View 5 Replies
View Related
Aug 21, 2014
I have a list or log that is updated by a number of people on a sharepoint file. The list consists essentially of 2 columns - lets call them Location and Date.
The Locations are populated from a pulldown list but can be repeated a number of times throughout the list. I have the list set up using Table Formatting so the range updates dynamically
Example:
Location Date
Site1 8/1
Site2 8/2
Site3 8/3
Site4 8/5
Site2 8/6
Site2 8/7
Site3 8/8
As this list gets items added to it I want to populate a summary table on another sheet showing the dates each site was visited like this...
____8/1 8/2 8/3 8/4 8/5 8/6 8/7 8/8 8/9
Site1 X
Site2 -----X-------------X---X
Site3 -------X
Site4 --------------X
(Had to add dashes above to get the X's spaced out properly)
I'm competent with lookups and such but I imagine this needs an array formula or some index/match combination which I'm a little weak on.
The solution should also not require any updating as the source list is updated periodically.
View 4 Replies
View Related
Dec 22, 2006
I am using excel to stop and start a service on the network and have that part done when using a txtfield to enter in the PC ID. What i want to do is use a list of PCIDs and pass them to my service object to stop and start the service.
Private Sub CommandButton1_Click()
Worksheets("PCIDs"). Range("B2").Select 'my issue is here
Range("B2").Activate 'and here
Do Until IsEmpty(ActiveCell)
Call StopService("ServiceName")
ActiveCell.Offset(1, 0).Select
Loop
Range("B1").Activate
Do Until IsEmpty(ActiveCell)
Call StartService("ServiceName")
ActiveCell.Offset(1, 0).Select
Loop
Worksheets("ServiceName").Select
End Sub
and with this function i need it to pass as a string to txtDeviceID. I have tried just simply setting txtDeviceID as ActiveCell but it didn't like that.
Public Function StopService(ServiceName As String) As Boolean
Dim oSysInfo As New ActiveDs.WinNTSystemInfo
Dim oComp As ActiveDs.IADsComputer
Dim oSvcOp As ActiveDs.IADsServiceOperations
Dim sCompName As String
Dim sSvc As String
Dim lRet As Boolean
View 3 Replies
View Related
Jun 29, 2006
I'm having a problem in a single line of code in which I'm using a Range Object to essentially select an area of cells whose contents I want cleared.
Here is the
Sheets(Left(c.Value, Len(c.Value) - 1)).Range(Cells(4, 2), " &:& ", Cells(Rows.Count, "b").End(xlUp).Offset(0, 9).Select).ClearContents
I want the range part to evaluate as (b4:whatever the last cell is before the first blank row).
View 9 Replies
View Related
Apr 13, 2007
I have some spreadsheets that rely on data being pulled in from external querys (from an SQL database).
the below line of code is part of a Workbook_Open() sub, which refreshes the data.
Selection.QueryTable.Refresh BackgroundQuery:=False
I have just got my hands on acopy of Excel 2007 (Yes!!!), but when i open my sheets my code now fails
Ater some messing around Ihave found that if I add ListObject" as below, it now works.
Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False
trouble is it doesn't work for the rest of the office, who didn't get Excel 2007
is it possible for me to have this so that it works for both flavours of Excel?
View 9 Replies
View Related
Jan 28, 2007
i'm writing a refrigeration selection user interface, working from values on an excel spreadsheet. how to get the programme to automatically select a value from a list or range once a user has selected corresponding value from a list within a combobox. for example if a user sets the temperature of their refrigerator to -5 celsius i need the programme to automatically select the corresponding value of enthalpy for the air at that temperature.
View 5 Replies
View Related
Dec 5, 2012
In my example you will see my name list that changes with a array to data validation. Seems like you can find ways around things most of the time but this time
View 4 Replies
View Related
Aug 30, 2012
I need the sum of a column in a table. In the sheet I am using "=SUBTOTAL(109;[Total])", but I need the absolute total in VBA. How is that possible?
View 1 Replies
View Related
Dec 7, 2007
I am trying to rename a text box, but it doesn't let me. The naming convention is fine, as it works with others. But it thinks that name is taken or something. So how can I see the names of all objects on a sheet?
View 9 Replies
View Related
May 19, 2014
I know how to get the row number of the cursor in a spreadhseet (Activecell.Row), but how do I get the cursor location in a list object so that I can then insert a new row for the user at that point?
BTW, I am using tables (ListObjects) because when a row is inserted, all of my formulas are automatically inserted.
View 1 Replies
View Related
Jan 6, 2010
I'm trying to select a range that will be changing by column. I'm not sure why my syntax isn't working. What I've got:
View 2 Replies
View Related
Apr 21, 2009
I'm trying to write a remove duplicates sub that can be passed the worksheet name and columns on which to check. It's pasted below. Above the key line is a commented out line of code that worked. So it works to pass theh worksheet, but I'm hung up on how to pass varying columns to it.
Sub RemoveDuplicatesSub(wksht, cols)
'Remove duplicates.
'Assumes that the data range is in a table
'Assumes the header row starts at row 7
Dim WS As Worksheet
Dim TableName As String
Set WS = Worksheets(wksht)
TableName = WS.ListObjects(1).Name
'WS.Range(TableName).RemoveDuplicates columns:=Array(3, 4, 5, 6, 7, 8, 9, 10), Header:=xlYes
WS.Range(TableName).RemoveDuplicates columns:=Array(cols), Header:=xlYes
End Sub
View 9 Replies
View Related
Jan 20, 2008
I have been working on large project using Excel VBA for several days. My code seems to be working correctly, but I have more to do and now, when I drag an object from the toolbox onto a UserForm, the object is not added to the list of objects on the form. If I go back to versions of the project that I was working on several days ago, there is no problem. If I run "Workbook Rebuilder", the objects that I have dragged onto the form are then added to the object list, but I still can't add new objects to forms from within the VBA editor. Is the project corrupted, or is there some other explanation, and are there any fixes? The code runs about 50 pages, and there are over 20 forms, so redoing from scratch is only a last resort option.
View 3 Replies
View Related
Nov 12, 2013
I am trying to find a way how to
1. Select a name from a list of name
2. Automatically change all the other sheets list of names to the same name.
e.g I have 9 timesheets with the same name list in the same cell. If an employee change name on the list in one of the 9 sheets, how to automatically update all the other sheets to the same name?
View 4 Replies
View Related
Jan 17, 2005
I'm getting the following error:
"Object library invalid or contains references to object definitions that could not be found"
I wasn't getting that error last night and I'm not sure what I may have done to cause this error.
It seems to be cause by code running on one sheet of my workbook, but I'm not really sure about that. I'm still a bit of a novice at VBA.
I'm using Excel 2002 SP3 and I'm running MS XP Home as my OS.
Do you have any ideas what can cause this error and/or how to trace down the offending objects/code?
View 9 Replies
View Related
Jan 26, 2010
I have a database that is setup and I want to add a ListBox to the userform and I know how to do that and add all the listbox entries.. my trouble is how do i save the selected entries(multiselect) to sheet and load them to the form (what was selected) using what i have below?
HTML ListBox1 = cells(n,5).value
and to save
HTML cells(n,5).value = ListBox1
View 4 Replies
View Related
Jan 3, 2012
Let's say you have a list of names:
BT
4 McDonald, Ronald
5 McCheese, Mayor
6 Burglar, Ham
7 King, Fakehead
8 Hut, Pizza
9
and you had "McCheese, Mayor" typed in AK23.
NOW, because you have that name in AK23, you want the next cell (AK31) to automatically select "Burglar, Ham". How?
So forth, and so on, for 2 more names....
When you get to the bottom of the list, and "Hut, Pizza" has been placed, how would you get it to start back at the top?
View 1 Replies
View Related
Feb 29, 2012
I have a list of things and i want to be able to select one of them, then be able to click a macro shortcut and have it select the next option down in the list so i can run through/look at the list quickly.
View 1 Replies
View Related
Apr 8, 2008
Private Sub cmdSubmit_Click()
If Me.lstProcess.Value = -1 Then
MsgBox "Please Select SPA Process", vbExclamation, "SPA Process"
Exit Sub
End If
ActiveWorkbook.Sheets("SPA Error Tracking").Activate
Range("B4").Select
Dim i As Integer
For i = 0 To lstProcess.List(i)
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True
With ActiveCell
.Value = txtLoanNumber.Value
.Offset(0, 1) = txtProsup.Value
.Offset(0, 2) = txtIssue.Value
.Offset(0, 3) = lstProcess.Value
End With
Next i
End Sub
1. What property would I use for the message box at the beginning, if the user has not made a selection?
2. I have the listbox set as multiselect. How can I update this code to take each selection and create a new row on the Error Tracking Sheet?
If the user selects multiple selections from the list box. I will need to create a separate row of data for each selection.
View 9 Replies
View Related
Jan 7, 2008
I need VBA code to select one word from a table of words so that only that word will be used in my spreadsheet for a particular cell.
View 9 Replies
View Related
Apr 30, 2014
I have a drop down list that is dependant on another drop down list, all this works fine, however if the user changes the first drop down list the second still continues to display the last option chosen by the user, is there a way to make the 2nd drop down list display "Please Use Drop Down List To Select An Option" instead, also is it also possible to do this without code?
View 3 Replies
View Related
May 31, 2009
I have a checkbox linked to cell F2, True=LH (Left Hand) and False = RH.
If I select RH I want to use the valadation list O3:O9, If I select LH I want the list to be Q3:Q9. Is this possible without using code? I am now using two other cells, one for each list RH & LH but it would be more convienant to ckeck the box and have the correct list available.
View 6 Replies
View Related
Oct 23, 2009
Say I have a list of 100 numbers (in column A). What formula would I use to have Excel list (in column B) 50 random numbers from the list of 100 or column A?
View 6 Replies
View Related