我需要一些棘手的功能幫助,我使用它來從MS Excel中的表格生成列分隔列表。MS Excel - 從CSV函數生成的逗號分隔列表中刪除零
我的數據如下:
Column A B C D E
John Bill 0 0 0
Steve 0 0 0
0 0 0
0 0 0
我創建了一個VBA函數,將將產生以下列表(每單細胞):
John,
Bill, Steve,
0,0,0,0,0
0,0,0,0,0
我堅持,因爲我不知道如何編輯我的功能,所以它不會包含帶零的列。
我的功能如下:
Function csvRange(myRange As Range)
Dim csvRangeOutput
For Each Entry In myRange
If Not Entry.Value = "" Then
csvRangeOutput = csvRangeOutput & Entry.Value & ", "
End If
Next
csvRange = Left(csvRangeOutput, Len(csvRangeOutput) - 1)
End Function
任何幫助將非常感激!
P.S.我已經嘗試過改變線路「如果不是Entry.Value =‘’ - 到 - 如果不是Entry.Value = 0或Entry.Value =‘’ - 不幸的是,這是行不通的!
感謝,
奧利
改變了說法。很肯定他坐字符串格式的單元格。 – Pedrumj