Thread: excel macro
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default excel macro

assume the cell of values to search is in a single column.

use the built in vlookup formula rather than code

assume the values to be found are in A1:A10

Further assume the range to be searched is on Sheet2, D1:D200 and you want
to return a value from column E
in C1 putting the formula

=if(countif(Sheet2!B:B,A1)0,Vlookup(A1,Sheet2!D:E 200,2,False),"")

then drag fill this down the column.

Regards,
Tom Ogilvy


Rick wrote in message
om...
I have no VBA experience but need to create a macro that:
1 takes a range of cells, searching for the content of each cell
within another sheet in the same workbook.
2 when it finds a match for the content, copies the contents of the
cell to right, and pastes it 2 cells to the right of the cell of the
original cell on the first worksheet.

I would appreciate any assistance you could offer! Thanks in advance.
Rick