|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
逗号连接,Excel会认为结果是个很大的数字,因此转换成科学计数法,如果用其他分隔号,就没有这个问题
- Sub whyn1()
- Dim i%
- For i = 1 To Range("A1048576").End(xlUp).Row
- If i = 1 Then Cells(i, 2) = Range("a1")
- If i > 1 Then Cells(i, 2) = Cells(i - 1, 2) & "|" & Cells(i, 1)
- Next
- End Sub
复制代码
如果一定要用逗号连接,就转换为文本型数字
- Sub whyn()
- Dim i%
- For i = 1 To Range("A1048576").End(xlUp).Row
- If i = 1 Then Cells(i, 2) = "'" & Range("a1")
- If i > 1 Then Cells(i, 2) = "'" & Cells(i - 1, 2) & "," & Cells(i, 1)
- Next
- End Sub
复制代码
|
|