Need to Search Column then Paste Data at end of Row? Advanced Filter?

  • Thread starter Thread starter DISMfish
  • Start date Start date
D

DISMfish

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
 
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(xlCellTypeVisible).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(xlCellTypeVisible)
c.Offset(0, 15) = "new value"
c.Offset(0, 16) = "new value"
Next
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top