summaryrefslogtreecommitdiff
path: root/wizards
diff options
context:
space:
mode:
Diffstat (limited to 'wizards')
-rw-r--r--wizards/source/sfdocuments/SF_Calc.xba19
1 files changed, 11 insertions, 8 deletions
diff --git a/wizards/source/sfdocuments/SF_Calc.xba b/wizards/source/sfdocuments/SF_Calc.xba
index 29b22f4b0ed0..8c9ab301370f 100644
--- a/wizards/source/sfdocuments/SF_Calc.xba
+++ b/wizards/source/sfdocuments/SF_Calc.xba
@@ -3550,6 +3550,7 @@ Private Function _ParseAddress(ByVal psAddress As String) As Object
''' CALCADDRESSERROR ' Address could not be parsed to a valid address
Dim oAddress As Object ' Return value
+Dim sAddress As String ' Alias of psAddress
Dim lStart As Long ' Position of found regex
Dim sSheet As String ' Sheet component
Dim sRange As String ' Range component
@@ -3582,20 +3583,22 @@ Dim oSelect As Object ' Current selection
.RawAddress = psAddress
Set .XSpreadSheet = Nothing : Set .XCellRange = Nothing
+ ' Remove leading '$'
+ If Left(psAddress, 1) = "$" Then sAddress = Mid(psAddress, 2) Else sAddress = psAddress
' Split in sheet and range components - Check presence of surrounding single quotes or dot
- If Left(psAddress, 1) = "'" Then
+ If Left(sAddress, 1) = "'" Then
lStart = 1
- sSheet = ScriptForge.SF_String.FindRegex(psAddress, "^'[^\[\]*?:\/\\]+'")
+ sSheet = ScriptForge.SF_String.FindRegex(sAddress, "^'[^\[\]*?:\/\\]+'")
If lStart = 0 Then GoTo CatchAddress ' Invalid sheet name
- If Len(psAddress) > Len(sSheet) + 1 Then
- If Mid(psAddress, Len(sSheet) + 1, 1) = "." then sRange = Mid(psAddress, Len(sSheet) + 2)
+ If Len(sAddress) > Len(sSheet) + 1 Then
+ If Mid(sAddress, Len(sSheet) + 1, 1) = "." then sRange = Mid(sAddress, Len(sSheet) + 2)
End If
sSheet = Replace(Replace(sSheet, "$", ""), "'", "")
- ElseIf InStr(psAddress, ".") > 0 Then
- sSheet = Replace(Split(psAddress, ".")(0), "$", "")
- sRange = Replace(Split(psAddress, ".")(1), "$", "")
+ ElseIf InStr(sAddress, ".") > 0 Then
+ sSheet = Replace(Split(sAddress, ".")(0), "$", "")
+ sRange = Replace(Split(sAddress, ".")(1), "$", "")
Else
- sSheet = psAddress
+ sSheet = sAddress
End If
' Resolve sheet part: either a document named range, or the active sheet or a real sheet