|
▼ema さん:
すでに ponponさんから回答がありますが、
Changeイベントを使うのでしょうか?
Sheet4(入力シート)の Worksheet_Changeイベントプロシージャに
記述してみてください。
'--------------------------------------------------------- Sheet4
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myRange As Range
Dim c As Range
Set myRange = [B1,B2,B4]
Set c = Intersect(Target, myRange)
If c Is Nothing Then Exit Sub
If WorksheetFunction.CountA(myRange) < 3 Then Exit Sub
Dim mon As Long
Dim m
Dim RefRange As Range
mon = Val([B1].Value)
Select Case mon
Case 1 To 12
With Worksheets("Sheet2")
Set RefRange = .Range("A2", _
.Cells(.Rows.Count, 1).End(xlUp))
End With
m = Application.Match([B2].Value2, RefRange, 0)
If IsNumeric(m) Then
RefRange(m, 2 + mon).Value = [B4].Value
End If
End Select
End Sub
|
|