[ 初めての方へ | 一覧(最新更新順) | 全文検索 | 過去ログ ]
『ダブルクリックで列に色をつける』(あろりん)
エクセルの表で、E3〜AI33の範囲に
ダブルクリックしたセルがある列に色を付けたいと思います。
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Intersect(Target, Range("E3:AI33")) Is Nothing Then Exit Sub
With Selection.Interior If .ColorIndex = xlNone Then .ColorIndex = 36 Else .ColorIndex = xlNone End If End With
Cancel = True
End Sub
これですと、ダブルクリックしたセルだけに色が付きます。
列に色を付けるには、どこを変えたらいいでしょうか・・・
< 使用 Excel:Office365、使用 OS:Windows10 >
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) If Intersect(Target, Range("E3:AI33")) Is Nothing Then Exit Sub
Rows(Target.Row).Interior.ColorIndex = IIf(Target.Interior.ColorIndex = xlNone, 36, xlNone) Cancel = True End Sub (???) 2019/06/17(月) 13:41
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) If Intersect(Target, Range("E3:AI33")) Is Nothing Then Exit Sub
Columns(Target.Column).Interior.ColorIndex = IIf(Target.Interior.ColorIndex = xlNone, 36, xlNone) Cancel = True End Sub (???) 2019/06/17(月) 13:56
色を付ける範囲をE3-AI33の範囲だけにとどめることはできますか?
(あろりん) 2019/06/17(月) 14:00
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) If Intersect(Target, Range("E3:AI33")) Is Nothing Then Exit Sub
Range(Cells(3, Target.Column), Cells(33, Target.Column)).Interior.ColorIndex = IIf(Target.Interior.ColorIndex = xlNone, 36, xlNone) Cancel = True End Sub (???) 2019/06/17(月) 14:56
[ 一覧(最新更新順) ]
YukiWiki 1.6.7 Copyright (C) 2000,2001 by Hiroshi Yuki.
Modified by kazu.