Sub 区域单元格填充数字()
Dim rng As Range
Dim cell As Range
Dim randomValue As Double
' 确保用户选中了一个区域
If Not Selection Is Nothing Then
' 循环遍历选中区域的每个单元格
For Each rng In Selection
' 生成一个2到99之间的随机数
randomValue = 2 + (99 - 2) * Rnd()
' 将随机数格式化为两位小数并赋值给单元格
rng.NumberFormat = "0.00"
rng.Value = Format(randomValue, "0.00")
Next rng
Else
MsgBox "请先选中一个区域。"
End If
End Sub