PDA

View Full Version : [SOLVED:] need help to construct vba to label order of value in a cell and rslt to nxt col plea



estatefinds
08-08-2016, 01:04 PM
So I have numerical data that I would like to select and run macro that would return the assigned Letter to a particular arrangement of four numbers in a cell.

there will be 24 of these different arrangements.

Each one will have a letter assigned to them.

1234 A
1243 B
1324 C
1342 D
1423 E
1432 F
2134 G
2143 H
2314 I
2341 J
2431 K
3124 L
3142 M
3214 N
3241 O
3412 P
3421 Q
4123 R
4132 S
4213 T
4231 U
4312 V
4321 W

So whenever I select a row of data it will return the order by way of the letter that identifies the order into the next column to the right of the that number.

Thank you very much in advance for your help!:)

Kenneth Hobs
08-08-2016, 01:51 PM
You need to be more explicit in what you want. Select a row means what? Where is the value to check, column A? Where to put the letter, column B?

If you don't need a Selection event to fire the macro, a simple vLookup should suffice. If the table data is Named kTable, and the number is in A1, then B1 would be: =VLOOKUP(A1,kTable,2)

estatefinds
08-08-2016, 02:54 PM
Actually I would need the selection event. Macro is best if at all possible, please :).

estatefinds
08-08-2016, 03:49 PM
Here is an example worksheet.
Thank you
if any questions or needing clarification please ask Thank you!:)
So the ultimate goal is select data in column A and it returnes the letter directly to the right for the type of order the value is; in the cell, and would continue until all are done.
the purpose is to have a macro to view a four number numerical value and the result would be an easy to read data in column B of how the numbers selected are in respect to how the order they appeared in.
like 1234 would be letter A

or 4312 would be W.

or if we look at other data like 4567 would be letter A or 7645 would be W.

etc.

so the letter A through X are the assigned letters for how the order of the combination of four numbers are displayed.

So I have numerical data that I would like to select and run macro that would return the assigned Letter to a particular arrangement of four numbers in a cell.

there will be 24 of these different arrangements.

Each one will have a letter assigned to them. so the data is a key to be so macro knows what to do.

1234 A
1243 B
1324 C
1342 D
1423 E
1432 F
2134 G
2143 H
2314 I
2341 J
2431 K
3124 L
3142 M
3214 N
3241 O
3412 P
3421 Q
4123 R
4132 S
4213 T
4231 U
4312 V
4321 W