E
EagleOne
Excel 2007 & 2003
If you are thinking "Not this group" I can understand. That said, I am not sure where else to start?
Assume myCell.formula = "=2620137"
also FormulaText = "=2620137"
Assume a "For Each objMatch In objcolMatches"
which produces an "objMatch" in VBA of 2620137
But in VB.NET, the FormulaTest is parsed like:
2
6
2
0
1
3
7
GOAL: How to get VB.NET to match the VBA result of 2620137?
Any thoughts appreciated
EagleOne
********************** Code ***************************************
Const CellRef As String = "\$?[A-Z]{1,2}\$?\d{1,5}"
Const SignOperator As String = "[/*^&()=<>,+]"
Const WithinString As String = """[^""]*"""
Const NumConstant As String = "-?(\d*\.)?\d+"
Ignore = (WithinString & ", " & CellRef & ", " & SignOperator _
& ", " & "|")
FormulaText = myCell.Formula
If objRegExp.Test(FormulaText) = True Then
' replace unwanted stuff
objRegExp.Pattern = Ignore
' Get the matches.
objRegExp.Pattern = NumConstant
objcolMatches = objRegExp.Execute(FormulaText)
End If
If you are thinking "Not this group" I can understand. That said, I am not sure where else to start?
Assume myCell.formula = "=2620137"
also FormulaText = "=2620137"
Assume a "For Each objMatch In objcolMatches"
which produces an "objMatch" in VBA of 2620137
But in VB.NET, the FormulaTest is parsed like:
2
6
2
0
1
3
7
GOAL: How to get VB.NET to match the VBA result of 2620137?
Any thoughts appreciated
EagleOne
********************** Code ***************************************
Const CellRef As String = "\$?[A-Z]{1,2}\$?\d{1,5}"
Const SignOperator As String = "[/*^&()=<>,+]"
Const WithinString As String = """[^""]*"""
Const NumConstant As String = "-?(\d*\.)?\d+"
Ignore = (WithinString & ", " & CellRef & ", " & SignOperator _
& ", " & "|")
FormulaText = myCell.Formula
If objRegExp.Test(FormulaText) = True Then
' replace unwanted stuff
objRegExp.Pattern = Ignore
' Get the matches.
objRegExp.Pattern = NumConstant
objcolMatches = objRegExp.Execute(FormulaText)
End If