没有查到这样的函数,倒是利用Len()函数实现了这样的功能。
For PathRow = 1 To MaxRow
For PathCol = FirstPathCol To FirstPathCol + ColPerPath - 1
Set CellValue = Worksheets("Sheet1").Cells(PathRow, PathCol)
If CellValue <> "" And IsNumeric(CellValue) Then
StrLen = Len(Format(CellValue))
For SpaceLen = 0 To 12 - StrLen - 1
StrSpace = StrSpace + " "
Next SpaceLen
StrContent = StrContent + StrSpace + Format(CellValue) + Chr(44)
End If
If CellValue <> "" And (Not IsNumeric(CellValue)) Then
StrLen = Len(CellValue)
For SpaceLen = 0 To 12 - StrLen - 1
StrSpace = StrSpace + " "
Next SpaceLen
StrContent = StrContent + StrSpace + CellValue + Chr(44)
End If
StrSpace = ""
Next PathCol
file.Writeline StrContent
StrContent = ""
Next PathRow
输出结果:
23f, abvd, eeee,
2323, 2323, 2323,
4623, 4623, 4623,
6923, 6923, 6923,
9223, 9223, 9223,
11523,
13823,
很整齐。
谢谢purana的关注。。。。