Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Search / Copy / Paste
Here's my situation:
I have one spreadsheet with 2 columns in them. Column 1 has values of data Column 2 has the key codes for the data. Example: column 1: Telephone TV Video Camera Column 2: A B C cell A1 value: Telphone cell A2 value: TV Cell A3 value: Video Camera Cell B1 value: A Cell B2 value: B Cell B3 value: C I want to be able to create a macro that will search Column 2. Say I search for the value "A" The output should be "Telephone" into another cell. So the steps I need is: Macro to search for the value from Column 2 Macro to select the value in Column 1 when result is found Macro to paste the value in Column 1 onto a new cell. I was thinking of using a command button that you can load in using the form function in excel. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Search / Copy / Paste
VBA is not needed. C1 = Value to search for D1 = =INDIRECT("A" &
MATCH(C1,B:B,0)) Note: The match function returns the position of the search item in the array, therefore if the array does not start with Row 1 then you will have to correct for that. Regards, Die_Another_Day RigasMinho wrote: Here's my situation: I have one spreadsheet with 2 columns in them. Column 1 has values of data Column 2 has the key codes for the data. Example: column 1: Telephone TV Video Camera Column 2: A B C cell A1 value: Telphone cell A2 value: TV Cell A3 value: Video Camera Cell B1 value: A Cell B2 value: B Cell B3 value: C I want to be able to create a macro that will search Column 2. Say I search for the value "A" The output should be "Telephone" into another cell. So the steps I need is: Macro to search for the value from Column 2 Macro to select the value in Column 1 when result is found Macro to paste the value in Column 1 onto a new cell. I was thinking of using a command button that you can load in using the form function in excel. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Search, Copy & Paste Formula | Excel Discussion (Misc queries) | |||
Search, copy and paste help | Excel Discussion (Misc queries) | |||
VBA-code for search,copy and paste | Excel Discussion (Misc queries) | |||
Search-Copy and Paste-code | Excel Programming | |||
Search/copy/paste Macro | Excel Programming |