Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Not exactly clear, but try this...
(and "\" is an arithmetic operator) --- Sub FigureItOut() Dim N As Long Dim M As Long Dim x As Long Dim strWhat As String Dim strGiven As String Dim vThings As Variant Dim strArr() As String ReDim strArr(1 To 100) 'some extras in the string strGiven = "-9'Min. Int.'!F26-'Min.-7 Int.'!F31+28038^35+[C:\123]'Clos-6ing'!E3^1" vThings = Array("-", "+", "^", "\", "/", "*") M = 0 For N = 0 To UBound(vThings) Do M = InStr(M + 1, strGiven, vThings(N), vbBinaryCompare) If M 0 Then If Mid$(strGiven, M + 1, 1) Like "#" Then strWhat = Mid$(strGiven, M, 2) x = x + 1 strArr(x) = strWhat End If Else Exit Do End If Loop Next ReDim Preserve strArr(1 To x) Range("A1", Cells(1, x)).Value = strArr() End Sub -- Jim Cone Portland, Oregon USA wrote in message 2003, 2007 What is the smartest way to be able to keep a "." (period) or a number from an cell address or worksheet name/link or a workbook name/link being considered in the Case line below: Dim CheckStr as string CheckStr = Activecell.formula TestChar = Mid(CheckStr, Counter, 1) TestAsc = Asc(TestChar) ..... ' Is current character a Number or a "." (period)? Case TestAsc = 48 And TestAsc <= 57 Or TestAsc = 46 ....... <Do things I need to consider the complete formula string so that I can obtain the starting position of every constant (defined as a number preceeded by a mathmatical operator) in the formula string. So I cannot delete anything from CheckStr. In short, I do not want the numbers from a cell address, a sheetname, workbook name or from a directory link to be considered. For example, in the formula below: =-'Min. Int.'!F26-'Min. Int.'!F31+2803835+[C:\123]'Closing'!E31 I do not want the "." or 26 or 31 or 31 or 123 to be considered "acceptable" by: Case TestAsc = 48 And TestAsc <= 57 Or TestAsc = 46 My thoughts have included but not limited to: 1) ActiveWorkbook.LinkSources(xlExcelLinks) 2) Toggling Booleen True/False for alternate " ' " in the formula string (elim w/s references) 3) Toggling Booleen True/False for alternate "[" then "]" for links Bottom line the VBA code to effectively: Case TestAsc = 48 And TestAsc <= 57 Or TestAsc = 46 (except "." and numbers which are not constants) Hopefully there is an easy way to do this that I have not considered. ?? TIA EagleOne |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Converting "uppercase" string data to "lower case" in CSV file | Excel Discussion (Misc queries) | |||
how do I count only lower case "x" and exclude upper case "X" | Excel Worksheet Functions | |||
String manipulation and creating an "offline" excel workbook | Excel Programming | |||
String manipulation and creating an "offline" excel workbook | Excel Programming | |||
Adding "And" clause in SQL string causing SQL Syntax error | Excel Programming |