|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- Private Sub Worksheet_Change(ByVal Target As Range)
- If Target.Address(0, 0) = "B1" Then
- If Len(Target) > 0 Then
- Z = Target
- x = Int(Target)
- y = Target - x
- Application.EnableEvents = False
- [b3:g3].Value = ""
- For i = 2 To 6
- Cells(3, i) = Int(Z / Cells(2, i))
- Z = Z - Cells(3, i) * Cells(2, i)
- Next i
- If Z = 0 Then
- Cells(3, 7) = 0
- Else
- x = Int(Z / Cells(2, 7))
- If Z = x * Cells(2, 7) Then
- Cells(3, 7) = x
- Else
- Cells(3, 7) = x + 1
- End If
- End If
- Application.EnableEvents = True
- End If
- End If
- End Sub
复制代码 |
|