Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
FIND function not defined in macro | Excel Programming | |||
Access connection works in Macro, not in user-defined Function | Excel Programming | |||
Macro user defined function row information | Excel Programming | |||
User Defined Function used in Macro returns #VALUE | Excel Programming | |||
Find size of array passed to user-defined function | Excel Programming |