Function ZDY() As String
s = ""
For i = Sheets("sheet1").Range("B65536").End(xlUp).Row To 1 Step -1
tmp = Sheets("SHEET1").Range("B" & i).Value
If tmp <> "" Then s = s & "," & tmp
Next
ZDY = Right(s, Len(s) - 1)
End Function
将上面代码放到”模块“中,然后在C1单元格输入:=zdy() 即可。