Skip to content

Commit f6eb704

Browse files
committed
BUGFIX: Using semi-colon
Using semi-colons (in .txt) will fix the problem that occurs when functions are used to define a range. Otherwise, the comma used to seperate the arguments of the function would interfere with the commas from the csv.
1 parent 5cd1e62 commit f6eb704

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/vbaDeveloper.xlam/NamedRanges.bas

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Attribute VB_Name = "NamedRanges"
22
Option Explicit
33

4-
Private Const NAMED_RANGES_FILE_NAME As String = "NamedRanges.csv"
4+
Private Const NAMED_RANGES_FILE_NAME As String = "NamedRanges.txt"
55

66
Private Enum columns
77
name = 0
@@ -37,8 +37,15 @@ End Sub
3737

3838

3939
Private Sub importName(wb As Workbook, line As String)
40+
Dim delimiter As String
41+
If InStr(line, ";") > 0 Then
42+
delimiter = ";"
43+
Else
44+
delimiter = ","
45+
End If
46+
4047
Dim parts As Variant
41-
parts = Split(line, ",")
48+
parts = Split(line, delimiter)
4249
Dim rangeName As String, rangeAddress As String, comment As String
4350
rangeName = parts(columns.name)
4451
rangeAddress = parts(columns.RefersTo)
@@ -64,7 +71,7 @@ Public Sub exportNamedRanges(wb As Workbook)
6471
For Each t In wb.Names
6572
Set aName = t
6673
If hasValidRange(aName) Then
67-
lines.Add aName.name & "," & aName.RefersTo & "," & aName.comment
74+
lines.Add aName.name & ";" & aName.RefersTo & ";" & aName.comment
6875
End If
6976
Next
7077
If lines.Count > 0 Then

0 commit comments

Comments
 (0)