Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
ac ac is offline
external usenet poster
 
Posts: 18
Default FIND function not defined in macro

I am using the FIND function to find a character in a text string. I have to
find the state (CA, MA) etc and have a text string "Mps/Stpaul, MN ".
So if I can find the "," I can use the "Right/Left" function to determine
the state. The help says that this function exists but the compiler is
giving me an error message.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default FIND function not defined in macro

Try the Instr function eg:
Sub test()
Dim str As String
Dim state As String
str = "Mps/Stpaul, MN "
state = Mid(str, InStr(1, str, ",") + 2, 2)
MsgBox state
End Sub

This is only going to work if your data is consistent e.g in your
example there are two spaces between the , and the state.

Hope this helps
Rowan

AC wrote:
I am using the FIND function to find a character in a text string. I have to
find the state (CA, MA) etc and have a text string "Mps/Stpaul, MN ".
So if I can find the "," I can use the "Right/Left" function to determine
the state. The help says that this function exists but the compiler is
giving me an error message.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default FIND function not defined in macro

it does exists.

MsgBox WorksheetFunction.Find(",", "ABCD,EFGH")
will give you 5

"AC" wrote:

I am using the FIND function to find a character in a text string. I have to
find the state (CA, MA) etc and have a text string "Mps/Stpaul, MN ".
So if I can find the "," I can use the "Right/Left" function to determine
the state. The help says that this function exists but the compiler is
giving me an error message.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default FIND function not defined in macro

Hi,
1. Does it break on the
WorksheetFunction.Find
or on something else such as the Left/Right vba functions?
2. could you please post some of your code?

--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"AC" wrote:

I am using the FIND function to find a character in a text string. I have to
find the state (CA, MA) etc and have a text string "Mps/Stpaul, MN ".
So if I can find the "," I can use the "Right/Left" function to determine
the state. The help says that this function exists but the compiler is
giving me an error message.

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 function not defined in macro AC Excel Programming 2 November 9th 05 10:09 AM
Access connection works in Macro, not in user-defined Function Steve[_77_] Excel Programming 3 May 27th 05 02:07 PM
Macro user defined function row information bj Excel Programming 4 March 9th 05 02:59 PM
User Defined Function used in Macro returns #VALUE hodler Excel Programming 1 July 30th 04 03:46 AM
Find size of array passed to user-defined function Cliff[_2_] Excel Programming 2 October 21st 03 02:09 AM


All times are GMT +1. The time now is 07:10 AM.

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"