![]() |
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? |
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? |
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? |
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 |
All times are GMT +1. The time now is 01:22 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com