|
んー・・数式をそのまま表示したいのなら・・
Private Sub Worksheet_Change(ByVal Target As Range)
Dim AdSt As String
Dim x As Long, Num As Long, Num2 As Long
With Target
If .Column > 1 Then Exit Sub
If .Row = 1 Then Exit Sub
If .Count > 1 Then Exit Sub
If IsEmpty(.Value) Then Exit Sub
If Not IsNumeric(.Value) Then Exit Sub
If .End(xlDown).Row > 65536 Then Exit Sub
Num = .Value
With .End(xlUp)
x = InStr(1, .Value, "+")
If Left(.Value, 1) = "=" And x > 0 Then
Num2 = Val(Mid(.Value, x + 1))
AdSt = "'=" & .Address(0, 0) & "+" & (Num + Num2)
Else
AdSt = "'=" & .Address(0, 0) & "+" & Num
End If
End With
Application.EnableEvents = False
.Value = AdSt
End With
Application.EnableEvents = True
End Sub
で、どうかな ? A列で任意の整数を入力してみて下さい。
|
|