View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Patrick Molloy[_2_] Patrick Molloy[_2_] is offline
external usenet poster
 
Posts: 1,298
Default Macro - searches for key word in a column and concatenates entire

why don't you just use a simple VLOOKUP
if your keyword is in D1, and you search for it in A:A concatenatign to B:B

the C1=D1 & VLOOKUP(D1,A:B,2,False)




"andrei" wrote:

Let's say i have a column A and column B with a lot of cells with different
content. For every cell in A column with content , there is a B cell with
content

What i want is macro which searches for given key word in column A . If it
finds it , it concatenates entire row (without spaces between content of
different cells) and puts in in column C ( let's say )

The most important thing is where it puts it . And i give in example :

key word : house

A1 : garden B1 : basement
A2 : house B2 : bedroom
A3 : mother B3 : father
A4 : house B4 : like a cottage

Finds keyword in A2 , concatenates A2-B2 ( result - housebedroom ) and puts
it in C1 !
Finds keyword in A4 , concatenates A4-B4( result - houselike a cottage ) and
puts it in C2 !

so on ...

In my case , as i said before , i don't need spaces between content from
different cells . For what i use it , the concatenated result makes sense
without spaces