添付図のように、C5セルを選択するとC5セルを赤く塗りつぶし、H5にC5の値を入れる。 それを5行目だけでなく6行目~複数行毎で実行したいです。
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim myRng5 As Range
Set myRng5 = Range("C5:G5")
myRng5.Interior.ColorIndex = 2
If Intersect(Target, myRng5) Is Nothing Or Target.Count > 1 Then Exit Sub
Target.Interior.ColorIndex = 45
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range) Dim myRng5 As Range Set myRng5 = Range("C" & ActiveCell.Row & ":G" & ActiveCell.Row) myRng5.Interior.ColorIndex = 2 If Intersect(Target, myRng5) Is Nothing Or Target.Count > 1 Then Exit Sub Target.Interior.ColorIndex = 45 Cells(ActiveCell.Row, "H").Value = ActiveCell.Value End Sub
コメント(0件)