|
▼Kein さん:さっそくのごしどうありがとうございます。
うまく行きませんでした。
対象のシートモジュールに
Private Sub Worksheet_Activate()
Application.OnKey "^{ENTER}", "MyCalc"
End Sub
Private Sub Worksheet_Deactivate()
Application.OnKey "^{ENTER}"
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Dim MyR As Range, C As Range
Dim Fom As String, St As String
On Error GoTo ELine
Set MyR = Target.SpecialCells(3, 1)
On Error GoTo 0
Application.EnableEvents = False
For Each C In MyR
Fom = C.Formula
If Left$(Fom, 6) <> "=ROUND" Then
St = Right$(Fom, Len(Fom) - 1)
C.Formula = "=ROUNDDOWN(" & St & ",0)"
End If
Next
Application.EnableEvents = True
Set MyR = Nothing
ELine:
End Sub
を入れて、
標準モジュールのを入れて、標準モジュールに
Sub MyCalc()
Dim Ad As String
If TypeName(Selection) <> "Range" Then Exit Sub
If Intersect(ActiveCell, Range("F6:F65536")) Is Nothing Then
Exit Sub
End If
With ActiveCell
If Not IsEmpty(.Value) Then Exit Sub
Ad = .Offset(-1).Address
.Formula = "=ROUNDDOWN(SUM($F$6:" & Ad & ")*0.15,0)"
End With
End Sub
です。
どこか解りますでしょうか?
|
|