请EXCEL专家Vba帮我做一个多个单元格的数字怎么才能合并到一个单元格呢 ?谢谢你们啦!

2024年11月17日 04:58
有1个网友回答
网友(1):

Function hb(xRng As Range, n As Integer) As String
Dim iFlag As Boolean
Dim i As Integer
Dim cell As Range
For i = 0 To 9
iFlag = False
For Each cell In xRng
If Mid(Format(cell, "0000.000000"), InStr(Format(cell, "0000.000000"), ".") + n, 1) = i Then
iFlag = True
Exit For
End If
Next
If iFlag Then hb = hb & i
Next
End Function

在J2输入 =hb(B2:I2,-1)
-1表示小数点左边1位
-2表示左边2位
1表示右边1位
2表示右边2位