Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Group,
I am trying to find the position in a string variable to extract some numbers. The string is (14)44, which is in a variable called WeekNo. I am trying to extract the number with in the ( ), which can be one or two digits long. I have tried using mm=application.worksheetfunction.find("(",WeekNo,2 ) to get the position, but this failed. I also tried mm=application.worksheetfunction.find('(',WeekNo,2 ) and failed. Finding the position is only an interim step to extracting the number and there may be an easier way. Thanks, David |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Have a look in vba help for INSTR
-- Don Guillett SalesAid Software "David" wrote in message ... Hi Group, I am trying to find the position in a string variable to extract some numbers. The string is (14)44, which is in a variable called WeekNo. I am trying to extract the number with in the ( ), which can be one or two digits long. I have tried using mm=application.worksheetfunction.find("(",WeekNo,2 ) to get the position, but this failed. I also tried mm=application.worksheetfunction.find('(',WeekNo,2 ) and failed. Finding the position is only an interim step to extracting the number and there may be an easier way. Thanks, David |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If the string always starts with ( then this should extract the number.
Sub useinstr() mr = Range("weekno") x = Mid(mr, 2, InStr(mr, ")") - 2) MsgBox x End Sub -- Don Guillett SalesAid Software "Don Guillett" wrote in message ... Have a look in vba help for INSTR -- Don Guillett SalesAid Software "David" wrote in message ... Hi Group, I am trying to find the position in a string variable to extract some numbers. The string is (14)44, which is in a variable called WeekNo. I am trying to extract the number with in the ( ), which can be one or two digits long. I have tried using mm=application.worksheetfunction.find("(",WeekNo,2 ) to get the position, but this failed. I also tried mm=application.worksheetfunction.find('(',WeekNo,2 ) and failed. Finding the position is only an interim step to extracting the number and there may be an easier way. Thanks, David |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Find First Non blank cell than find column header and return that value | Excel Worksheet Functions | |||
Despite data existing in Excel 2002 spreadsheet Find doesn't find | Excel Discussion (Misc queries) | |||
find and delete duplicate entries in two columns or find and prin. | Excel Programming | |||
find and delete text, find a 10-digit number and put it in a textbox | Excel Programming | |||
backwards find function to find character in a string of text | Excel Programming |