[セルの移動で色を変える]
セルの移動と同時に色をかえます。


---> マクロを書く場所は、[Private Sub
Worksheet_SelectionChange(ByVal Target As Range)]です。
[セルの移動で、色を変える / その1]

Private Sub Worksheet_SelectionChange(ByVal Target As
Range)
'セルの移動で色を変える
'ActiveCell.Interior.ColorIndex =
37
'備考:「 = 37 」の数値を変えると別の色になります。
End Sub
[セルの移動で、色を変える /
その2]
*選択しているセルだけ。(同一行の他の列には色をつけない)

Private Sub Worksheet_SelectionChange(ByVal Target As
Range)
'---------------------------------
'選択しているセルだけ色をつける
'---------------------------------
'選択行のセルの色を消す
Rows(ActiveCell.Row).Interior.ColorIndex
= xlNone
'色をつける
Cells(ActiveCell.Row,
ActiveCell.Column).Interior.ColorIndex = 37
End Sub
[セルの移動で、色を変える / その3]
* 行全体の色を変えます

## 下から貼り付けてください。
Dim thatRow As Long
Dim thisRow
As Long
Private Sub Worksheet_SelectionChange(ByVal Target As
Range)
'===========================================
'
行全体の色を変える (選択行のみ)
'===========================================
On
Error Resume Next
thisRow =
ActiveCell.Row
Rows(thatRow).Interior.ColorIndex =
xlNone
Rows(thisRow).Interior.ColorIndex = 37
thatRow =
ActiveCell.Row
End Sub
|