I have trouble with some VBA for Excel 2010. I have a list of names with which different serial numbers are connected. The following code will look up a name in column A, look in the name dictionary for the array of serial numbers associated with this name and print each number in the new column.
Name dictionary:
name ("jane b") = [111112, 22222]
Output:
| Joe A. 11111 | Jane B. 111,112. 22222 | | Jim C | 11111 | 121212 | 1122112
Code:
Slow name, I = 2 worksheets for counter ("Contact"). UsedRange.Rows.Count name = worksheet ("cells (i, 2 + counter). Cell = (i, 2) counter = 0 if names.Exists (name) then name (name) worksheet for each name (" contact " ) .Value = serial counter = counter + 1 next serial and if next I
So far, very good but output format is not good for input in. Instead, Want to format:
| Joe A. 11111 | Jane B. | 111112 | Jane B. | 22222 | Jim C | 11111 | Jim C | 121212 | Jim C | 1122112
< / Pre>This is my code:
I have = 2 worksheets ("contact") for the negative name, counter. UsedRange.Rows.Count name = worksheets ("contact"). I, 1) counter = 0 if name is .xis (name) for each name, name (name) for worksheets ("contact"). Cell (i + counter, 2) value = serial worksheets ("contact") Cell (i + counter, 1) .value = name worksheets ("contact"). Cell (i + counter + 1, 1) .interrorase.over counter = counter + 1 next serial end if next May include
This am is where I run into a problem. My output looks like this:
| Joe A. 11111 | Joe A. 1700 | Joe A. 1700 | Joe A. 1700 | Joe A. 1700 | Joe A. 1700 | Joe A. 1700
While all the numbers have been made, outputting what is actually the output of 1700, although it is not related to any serial number (???).
Can someone shut down in my code?
Thank you all for your time and consideration.
With gratitude,
Zack
try it out : Use a new sheet (example: "newcut sheet"). Instead of inserting rows in the current contact sheet, which lets you insert a line, then scan the next line (which you just entered) and insert it again and again
Then contact sheet at one time Scan a line, and compare the exact same type of dictionary as you are, once in the name of one serial, you add cells 1 and 2 to the new sheet and raise the row.
Based on the original post, "without a trial", and "so far so good" ...
Sub Serial Name () Integer Brains in the form of string-num counter counting the integer dimension as the new short string in the form of an integer as integer dim I integer new sheet = "NewContactSheet" nRow = 2 last contact = worksheets ("Contact "). For the last used for Range.Rows.Count I = 2, contact Name = Sheet ("Contact"). Cell (i, 1) if the name Name (name) for each name for serial (name (sheets) (new sheet) .mail (NRO, 1) = name sheets (new sheet). Cell (NRO, 2) = serial NRO = NRO + 1 serial And if Next I & SA
Comments
Post a Comment