EO,
If this is any help, would you at least consider not bottom posting? <g
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
Function OperateWhat()
'Finds the position of the first and last operator in the active cell formula.
'Jim Cone - San Francisco - April 2007
Dim vSigns As Variant
Dim lngFirst As Long
Dim lngLast As Long
Dim lngTemp As Long
Dim N As Long
vSigns = Array("+", "-", "*", "/", "^", "", "<", "<", "=", "<=")
lngFirst = Len(ActiveCell.Formula)
For N = 0 To 9
lngTemp = InStr(1, ActiveCell.Formula, vSigns(N), vbTextCompare)
If lngTemp 0 Then
If lngTemp < lngFirst Then lngFirst = lngTemp
If lngTemp lngLast Then lngLast = lngTemp
End If
Next
If lngFirst <= lngLast Then
'?
Else
'?
End If
MsgBox lngFirst & vbCr & lngLast
End Function
'----------------
"EagleOne"
wrote in message
Jim,
I should have mentioned that the following code works:
BeginStr = Len(Left(ActiveCell.Formula, InStr(ActiveCell.Formula,
"'!") + 1))
EndStr = InStr(BeginStr, ActiveCell.Formula, "?????????????")
If I could figure how to "replace" "?????????????" (above) with any
Operator
like + - * / = the challenge is solved.
Is there a function which will give me the string position of any
(or minimally the first) operator in ActiveCell.Formula?
EagleOne