ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   excel macro (https://www.excelbanter.com/excel-programming/279959-excel-macro.html)

Rick[_18_]

excel macro
 
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

Tom Ogilvy

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





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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com