The code works well. Though there are a few that that i dont understand.
The same range in used for the listbox and the combobox. Though i cannot send the Variable Rng through the scripting dictonary it seams that this function is looking at the range in a diffrent manner to a standard range.
so you see i have another variable datarng for use in the function though if i use set to set the variable as the range it wont like that either.
Can I use my listbox contents to populate a scripting dictionary?
Dim a, z As Long Set dic = CreateObject("scripting.dictionary") With Sheets("Changes") a = ListBox1.List 'a = .Range("b1", .Range("b" & Rows.Count).End(xlUp)).Offset(, -1).Resize(, 10).Value End With
For z = 2 To UBound(a, 1) If Not dic.exists(a(z, 2)) Then ReDim w(1 To 10, 1 To 1) For zz = 1 To 10: w(zz, 1) = a(z, zz): Next dic.Add a(z, 2), w Else w = dic(a(z, 2)) ReDim Preserve w(1 To 10, 1 To UBound(w, 2) + 1) For zz = 1 To 10: w(zz, UBound(w, 2)) = a(z, zz): Next dic(a(z, 2)) = w End If Next ComboBox2.List = dic.keys ComboBox2.Value = Sheets("Calendar").Range("E3").Value This code doesn't work because the bold line falls over.... the Remmed statement below it works fine though...
removing duplicates from a the first column of a two column table while maintaining the data in the second column. Unfortunately my skills fall short and I have been unable to alter the code to work for a 5 column table.
For example, if I might have data that might look something similar to this: ....
I have two dictionary objects populated with various keys and items - Dict1 and Dict 2. I've read that the items of a dictionary object can be quite varied, even another dictionary! I know how to add items to keys if those items are strings say, but how to add an entire dictionary (Dict2) as the items of another dictionary (Dict1)?
If I hadn't read it on here, how would I have know that they existed? They are not mentioned in the standard Excel help files (not that I could see anyway).
What other "objects" are available? I had a look through the references in the VBE and there are literally hundreds on items which all look pretty "juicy". Does that mean there are a whole host of other objects that I could use in my Excel spreadsheets to either make them simplier or more powerful?
If so, where does one find any reference info on them?
I have been tasked with doing a retail over/short Spreadsheet. The spreadsheet will be 13 tabs with 12 being the months and the 13th being the yearly summary. On each sheet will be the cashiers name.
I need to be able to script the addition of a new cashier and have them added alphabetically to all 13 sheets and at the same time keep all currently entered information with the appropriate person
I have date values in a range of cells, and have named the range "ChangeRange".
How would I:
1. loop through the range to store the current value of each cell in a scripting directory? 2. use vba to compare the values in that dictionary to the current value of the cell when it changes (NOTE: the change is by formula, not by manual insertion of a new value? 3. write that old cell value in the cell immediately to the right of the cell when it changes and update the dictionary value with the "new" old value? 4. do this for more than one range of dates on the same page?
Say you define a public range variable called Inputworksheet and you set it to refer to the worksheet called Inputworksheet. You have a separate string variable with the value Inputworksheet. How do you get this string variable value to call/control the range variable Inputworksheet?
I am getting an excel worksheet value from a lookup function that corresponds to the name of a VBA range variable. Once I have this worksheet value, I would like to use the range variable that has the same name as the worksheet value.
I am using a variable named " Totals" as a range type to refference the range in a formula. It works the way I have it.
Dim Totals As Range Set Totals = [U37: AE37]
Now instead of the absolute refference, I would like to change the row refference by an offset of my current row, using a formula with a varriable. The columns stay the same.
I have 2 dictionaries; both have a "location" and the "frequency of occurence". The 2nd dictionary locations are related to the first, but are named differently, so I have a range of cells I'm using to define the equivalent locations, ie:
Dict. 2 Location----Dict. 1 Location Wrapper------------Packaging Robot----------------Robot Arm Robot----------------Robot Base etc..
(It's not a direct 1 for 1)
The program is meant to take both dictionaries, convert the 2nd dictionary keys to the equivalent dictionary 1 keys (based on the cell range data provided) and then combine the values associated with that location and store them in D_Master. D_Master is a copy of my dictionary 1, in which I am also trying to add the values from dictionary 2.
I started by writing the location definitions within the program, i.e.:
[Code]....
which works, but there are several hundred definitions and it becomes less robust, whereas a user could type in a definition within the range of cells and the code below could take care of the rest.
i have to reverse a very big wordlist containing four coulmns. Column A words, Column B Transcription, Column C Grammar and Column D Meanings. Now i would like to make the meanigs (seperator is ";") to words and words to meaning in another new worksheet added by a macro. For example English-French would then become French-English wordlist.
If the original worksheets name is "x" then a new worksheet should be added with name "Re-x". This new sheet should then contain the new wordlist. For example:
The comparison between 2 sheets is made in a Class and the Result of the comparison is to be coded in a Module. How the result has to look like is attached as result.xls
I think it has to beginn like this
Sub DisplayResult(ByVal RESULT As Dictionary) . . . . End Sub
I have dictionary defined as series of keys and let's say two values:
name1,val1A,val1B name2,val2A,val2B ...and so on
I would like to define named range from "name" column allowing user to select desired name from combo on another sheet. This is easy
But after that I would like to get val1 and val2 for selected name and show them with some calculation; For example to construct two columns like this: <nameX_selected_from_combo>, (<val1X>+<val2X>)/2
All the problem is how to select values from the same row as name selected in range.
I have two wordlists (dictionaries) in two sheets and want to make third dictionary out of them in a third sheet.
The first dictionary is Iranian-German and the second one is German-English. Now the macro is supposed to make a third dictionary Iranian-German-English. The new wordlist should contain all words from first list, even if some of them are not translated through macro.
attached excel file to understand the problem better.
I know the Dictionary Object is confined to the Microsoft Word Object structure though can it be used in Excel. If not, is there a suitable replacement.
I am trying to write a macro which will autofill specific columns. The macro will set the range from the start of my autofill to the end of my autofill as a constant range.
The problem I need to get around is the end of my range can always change each time I run the macro. For instance, the first time I run the macro I may only need to autofill from row 4 to row 15. The next time, I may only need to autofill from row 4 to 23 (because of user updates). How can I make the end of my range not be a constant address but variable?
I have a VBA code which checks the value of two cells in "Sheet2", and when these values are in the fourth column of "Sheet4", then dictionary is saved and after that VBA delete Entire Rows in "Sheet4" which consists these values.
Please find the code below:
VB: Sub dictionary1() Application.ScreenUpdating = False
Dim dico1 As Scripting.Dictionary Set dico1 = New Dictionary
[Code] .....
Now I wonder how to add more conditions like for example: "Delete all rows in "Sheet4" which have for instance in the 6th column text "Hello" AND which have in the 7th column value greater than 10". How can I change the existing code?
This is of course just an example, but the underlying question is how can I add to these dictionaries more conditions. Of course, we can still use "Sheet2" to add some value which we want dictionary to store.
I want to use for this only dictionaries because spreadsheet is large and filtering doesn't work at all...
I have 2 tables, one on the left and another one the right, I want to check existance of ID and date in table in left, if match then plant the details as below. I manage to do the matching, but the result isn't correct.
Matching.jpg
Download workbook here [URL]
VB: Sub vk() Dim err As Worksheet: Set err = Sheets("Sheet1") Dim a As Object: Set a = CreateObject("Scripting.dictionary")
I am working on the last step in a very long project, how to filter my data based on keys in a dictionary.
The data I am working with (in the ActiveSheet) has a list of names (in column 6). I want to add these names as keys in the dictionary and the corresponding location (in column 7) as the items. Then, I want to filter the data by each key in the dictionary, copy the filtered data, and paste it into another workbook. I have included the code I have so far. It seems to work exactly how I want as long as I'm not using the dictionary.
create a macro that will generate 2 words from the dictionary. The first word needs to start with the letter B and the second word must start with the letter T.
I have created a dictionary with technical terminology. It is in excel format with about 10,000 entries. The format of my dictionary ("Sheet1") is in three columns:
<vocabulary term> <pronunciation> <definition>
Now, I want to create vocabulary lists using my dictionary. The newly typed up vocabulary list (which only has the term, but not pronunciation or definition), will be copy and pasted into "Sheet2".
The "Sheet2" typed up vocabulary list is in the format:
<vocabulary term 1> <vocabulary term 2> etc...
I want to run a macro or script to dictionary terms (including pronunciation and definition) from "Sheet1" and put them into my vocabulary list "Sheet2".