Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro - Find Function not working

When I used the FIND function in a macro I get an "Compile Error" function
not defined". It works fine when I use it in a cell in a worksheet. Is
there a seperate Reference that needs to be added?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Macro - Find Function not working

Hi

If it is the worksheetfunction find you want to use, you have to use:

WorksheetFunction.Find(...)

If this does not help, post your code for further help.

Regards,
Per


"Greg T" skrev i meddelelsen
...
When I used the FIND function in a macro I get an "Compile Error" function
not defined". It works fine when I use it in a cell in a worksheet. Is
there a seperate Reference that needs to be added?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Macro - Find Function not working

Find means two different thing:

1. a function
2. a method

In a worksheet cell:

=FIND("happiness",A1)

will look for "happiness" in A1 and return a number telling you where it
begins. To do this in VBA, use:

Sub dural()
Dim A1 As Range
Set A1 = Range("A1")
x = Application.WorksheetFunction.Find("happiness", A1)
End Sub


--
Gary''s Student - gsnu200908


"Greg T" wrote:

When I used the FIND function in a macro I get an "Compile Error" function
not defined". It works fine when I use it in a cell in a worksheet. Is
there a seperate Reference that needs to be added?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Macro - Find Function not working

If you're looking to find something in a string, then use VBA's built-in Instr()
function.

No need to use application.find() or worksheetfunction.find().



Greg T wrote:

When I used the FIND function in a macro I get an "Compile Error" function
not defined". It works fine when I use it in a cell in a worksheet. Is
there a seperate Reference that needs to be added?


--

Dave Peterson
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 and Replace function not working wt.pm Excel Discussion (Misc queries) 2 April 14th 09 05:16 PM
My Find and Replace function in Excel is not working? BPeach Excel Worksheet Functions 2 December 20th 06 11:27 PM
Find Function not working on protected sheet Hippy Excel Worksheet Functions 1 December 14th 06 03:14 PM
Help!!!!!! - Find Function not working from C# [email protected] Excel Programming 0 June 7th 06 09:49 PM
VBA Excel/Access Find function (Ctrl+F) not working VBA_Beginner Excel Programming 0 February 13th 06 03:17 AM


All times are GMT +1. The time now is 09:22 PM.

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

About Us

"It's about Microsoft Excel"