Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Find syntax
Hi all
I have code that works fine to search through a worksheet row by row, locate a string anywhere in a row and, if found, copy that entire row to a different worksheet: For r = firstRow To lastRow Set c = Rows(r).Find("M123") If Not c Is Nothing Then Rows(r).Copy Sheets("SubData").Activate Range("A65000").End(xlUp).Offset(1, 0).PasteSpecial (xlPasteValues) Range("A65000").End(xlUp).Offset(0, 0).PasteSpecial (xlPasteFormats) Sheets("AllData").Activate End If Next r However, I need to amend this so the search for a string is only carried out on one particular column of each row (column K). I've tried all sorts of permutations of the find syntax without success. Can anyone help please? Many thanks Sue |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Find syntax
Hi Sue,
Try Set c = Intersect(Rows(r), Columns("K")).Find("M123") --- Regards, Norman "SueJB" wrote in message ... Hi all I have code that works fine to search through a worksheet row by row, locate a string anywhere in a row and, if found, copy that entire row to a different worksheet: For r = firstRow To lastRow Set c = Rows(r).Find("M123") If Not c Is Nothing Then Rows(r).Copy Sheets("SubData").Activate Range("A65000").End(xlUp).Offset(1, 0).PasteSpecial (xlPasteValues) Range("A65000").End(xlUp).Offset(0, 0).PasteSpecial (xlPasteFormats) Sheets("AllData").Activate End If Next r However, I need to amend this so the search for a string is only carried out on one particular column of each row (column K). I've tried all sorts of permutations of the find syntax without success. Can anyone help please? Many thanks Sue |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
find syntax help please | Excel Programming | |||
Correct find syntax | Excel Programming | |||
Excel97 - Syntax for Find, Offset, Insert Page | Excel Programming | |||
Find method syntax | Excel Programming | |||
Macro syntax - how to find them | Excel Programming |