ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Need to Search Column then Paste Data at end of Row? Advanced Filter? (https://www.excelbanter.com/excel-programming/361350-need-search-column-then-paste-data-end-row-advanced-filter.html)

[email protected]

Need to Search Column then Paste Data at end of Row? Advanced Filter?
 
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


dmthornton

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




All times are GMT +1. The time now is 12:08 AM.

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