View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Michael Michael is offline
external usenet poster
 
Posts: 791
Default Search Column then Paste Data at end of Row?

You can try setting all of the cells containing the strings to be found in a
range using something like this:

Lastrow= Range("P65536").end(xlup).row
set Rng = Range("P1:P" & Lastrow)
Then loop through each occurrence comparing it to what is in your Column A
for example, and if found use the cell.offset functionality to place the var1
or var2 value. During the same loop you can insert a counter x=x+1 or
something similar. And when it gets out of the loop reset the x value to 0,
taking first the current value of x and placing it into the cell of your
choice.

" wrote:

Hi,
I am going nowhere quick searching for this, so hopefully someone can
help me.

I have a sheet with "x" number of rows of data. I would like to search

the second column for a specific string. Each time the string is
found, I need to paste the value of variable "var1" and "var2" into
column Q and R of that row. I would also like to know how many times
the string was found at paste value into the first column of that row.


I'm sure I could use a For loop to do this, but the data sheet can be
very long and I was wondering if there was a better way to do this with

the ".find()" or ".advancedfilter()" functions.


Thanks,
Logan