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

I'm glad I saw your posting. I never thought of using the advancedfilter
function for something like this, but I think it could save time. I played
arround with it and came up with this. I think if you tweek it, it should
work.

Selection.AutoFilter Field:=2, Criteria1:="FindThisString"
Dim lngCount As Long
lngCount = Range("B2",
Range("B65536").End(xlUp)).SpecialCells(xlCellType Visible).Count 'lngCount
will give you the totoal number of rows

'Do for only the visible cells
For Each c In Range("B2",
Range("B65536").End(xlUp)).SpecialCells(xlCellType Visible)
c.Offset(0, 15) = "new value"
c.Offset(0, 16) = "new value"
Next



" 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