Dim Kx(1 To 300) As Double ' Ky=Kx.
Dim Kz(1 To 300) As Double
For i = 1 To maxKzn
'To add commas, use Write command.
'To avoid commas, use Print command
a = Kx(i)
b = Kz(i)
If a > 0 Then
a = Format(Kx(i), "0.000e+00")
b = Format(Kz(i), "0.000e+00")
End If
Print #1, i, a, a, b, "0.000e+00"
Print #1, Format(tm, "#.00\,"), Format(hw, "#.00\,"), 1 <== Comma is added!!!
Next i
Sub export_DB_toGWV()
Dim Kx(1 To 300) As Double ' Ky=Kx.
Dim Kz(1 To 300) As Double
ThisWorkbook.Activate
filePath = ActiveWorkbook.Path
outFN = filePath & "\" & "out_Kdb_toGWV_1a.csv"
inSht = "TrTcModel-v1b"
maxKzn = 300
' Set 0
For i = 1 To 300
Kx(i) = 0#
Kz(i) = 0#
Next i
' Assign values
For i = 2 To 116
znID = Sheets(inSht).Cells(i, "J")
If znID <> "" Then
Kx(znID) = Sheets(inSht).Cells(i, "K")
Kz(znID) = Sheets(inSht).Cells(i, "M")
End If
Next i
Open outFN For Output As #1
Print #1, " Kx Ky Kz " ' Use Print instead of Write.
Print #1, maxKzn
For i = 1 To maxKzn
'To add commas, use Write command.
'To avoid commas, use Print command
a = Kx(i)
b = Kz(i)
If a > 0 Then
a = Format(Kx(i), "0.000e+00")
b = Format(Kz(i), "0.000e+00")
End If
Print #1, i, a, a, b, "0.000e+00"
Next i
Close #1
MsgBox "Done - SS calibration."
End Sub