Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 644
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Search, Copy & Paste Formula chanse25 Excel Discussion (Misc queries) 1 March 13th 08 05:44 PM
Search, copy and paste help [email protected] Excel Discussion (Misc queries) 0 June 15th 07 02:48 AM
VBA-code for search,copy and paste TUNGANA KURMA RAJU Excel Discussion (Misc queries) 0 December 12th 05 12:40 PM
Search-Copy and Paste-code Bourbon[_29_] Excel Programming 0 January 28th 04 07:54 PM
Search/copy/paste Macro mjwillyone Excel Programming 2 December 27th 03 07:49 AM


All times are GMT +1. The time now is 04:56 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"