在電子表格中,我試圖以某種方式使其輸入到 D 列中的單元格中的任何新數值乘以 85%。基本上,如果我轉到 D 列中的任何單元格 2-100,000 并輸入一個數值,我希望它自動顯示其中的 85%。
如果我在 D5 中輸入“100”,我希望它顯示“85”。
如果我在 D317 中輸入“200”,我希望它顯示“170”。
這有可能以任何方式做到嗎?
不能使用手動乘以另一個單元格或乘以 0.85。
太感謝了!
uj5u.com熱心網友回復:
作業表更改:修改列中的任何輸入
表模塊例如Sheet1
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim irg As Range
With Range("D2") ' from 'D2' to the bottom-most row:
Set irg = Intersect(.Resize(Rows.Count - .Row 1), Target)
End With
If irg Is Nothing Then Exit Sub
Application.EnableEvents = False
Dim iCell As Range
For Each iCell In irg.Cells
If IsNumeric(iCell.Value) Then
iCell.Value = 0.85 * iCell.Value
End If
Next iCell
Application.EnableEvents = True
End Sub
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/437783.html
下一篇:Range(Cell.Find("價格標簽"),Range(Cells.Find("價格標簽")).End(xlDown))
