Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default How can I use the worksheet function FIND in VBA or is there a FIN

Hi everyone!

I'm trying to parse of a string from a cell in VBA.
I need to go thru one sheet "find" a sub-string within a cell and if it's
there copy that
row into a different sheet.

I tried using =IF(FIND("C2PC",G101),"yup","nope"), but I get an error.
I can't "find" a FIND in VBA.

Please help.
Regards, Kurt
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How can I use the worksheet function FIND in VBA or is there a FIN

Dim rng as Range
set rng = Cells.Find(What:="C2CP", _
After:=ActiveCell, _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
if not rng is nothing then
rng.EntireRow.copy Destination:=worksheets("Sheet2").Range("A2")
else
msgbox "Not found"
End if

--
Regards,
Tom Ogilvy


"kurt" wrote in message
...
Hi everyone!

I'm trying to parse of a string from a cell in VBA.
I need to go thru one sheet "find" a sub-string within a cell and if it's
there copy that
row into a different sheet.

I tried using =IF(FIND("C2PC",G101),"yup","nope"), but I get an error.
I can't "find" a FIND in VBA.

Please help.
Regards, Kurt



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default How can I use the worksheet function FIND in VBA or is there a FIN

Kurt,

You can use Instr

iPos = instr(Range("G101","C2PC")
If iPos 0 Then
MsgBox "yup"
Else
MsgBox "nope"
End If

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"kurt" wrote in message
...
Hi everyone!

I'm trying to parse of a string from a cell in VBA.
I need to go thru one sheet "find" a sub-string within a cell and if it's
there copy that
row into a different sheet.

I tried using =IF(FIND("C2PC",G101),"yup","nope"), but I get an error.
I can't "find" a FIND in VBA.

Please help.
Regards, Kurt



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 170
Default How can I use the worksheet function FIND in VBA or is there a FIN

FYI, FIND's semi-equivalent in VBA is Instr() but based on your description,
I think you want to use Tom Ogilvy's response.

--
George Nicholson

Remove 'Junk' from return address.


"kurt" wrote in message
...
Hi everyone!

I'm trying to parse of a string from a cell in VBA.
I need to go thru one sheet "find" a sub-string within a cell and if it's
there copy that
row into a different sheet.

I tried using =IF(FIND("C2PC",G101),"yup","nope"), but I get an error.
I can't "find" a FIND in VBA.

Please help.
Regards, Kurt




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Find last non-blank row with a worksheet function Bruce Excel Worksheet Functions 2 November 25th 05 05:10 AM
Worksheet Function - Find? DAA Excel Worksheet Functions 2 February 24th 05 04:15 PM
for stats worksheet in XL how do i find the minitab function freethrow18 Excel Worksheet Functions 1 February 2nd 05 05:38 AM
VB and Find worksheet function Neal Zimm Excel Programming 14 January 17th 05 11:43 PM
Using Worksheet Function Find in VBA bcmiller[_2_] Excel Programming 4 May 21st 04 09:48 AM


All times are GMT +1. The time now is 03:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"