Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

finding copied text

Status
Not open for further replies.

Luis939

MIS
Feb 28, 2003
453
US
i'm trying to copy a cell's content from one file and using the Find method (ctrl+F) in another. Until now I had pasted that text in the other file and them said
.find(what:=activecell...
but is there a way to not have to paste that text, just say search for what is in the clipboard, perhaps set that text to a variable and do a find for that variable, thanks!
 
Presumably you are doing the copy from a selection or range definition - something like selection.copy or range("A1").copy

Instead of that, use
fWhat = selection.text
or
fWhat =range("A1").text

Then use
With sheets("Sheet2").columns(1)
set fCell = .find(fWhat, lookin:=xlvalues)
if not fCell is nothing then
'Found
else
'Not Found
end if
end with Rgds
Geoff
"Some cause happiness wherever they go; others whenever they go."
-Oscar Wilde
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top