Excel365
Thành viên tích cực


- Tham gia
- 29/10/10
- Bài viết
- 865
- Được thích
- 127
- Giới tính
- Nam
[GPECODE=vb]Option Explicit
Private Sub CheckBox1_Click()
Cells.FormatConditions.Delete
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Cells.FormatConditions.Delete
ActiveCell.EntireRow.FormatConditions.Add 2, , ActiveSheet.CheckBox1.Value
ActiveCell.EntireRow.FormatConditions(1).Interior.ColorIndex = 8
End Sub
[/GPECODE]
Code trên em tìm trên diễn đàn, lâu quá ko nhớ của ai.
Code trên hiện tại chỉ tô màu cho dòng khi checkbox được chọn. Nay em muốn cho nó tô màu luôn cột khi checkbox được chọn
P/s: Em có thể bổ sung thêm 2 dòng code
[GPECODE=vb]ActiveCell.EntireColumn.FormatConditions.Add 2, , ActiveSheet.CheckBox1.Value
ActiveCell.EntireColumn.FormatConditions(1).Interior.ColorIndex = 8
[/GPECODE]
đổi row thành column nhưng không được.
Rất mong được các anh chị giúp đỡ
Private Sub CheckBox1_Click()
Cells.FormatConditions.Delete
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Cells.FormatConditions.Delete
ActiveCell.EntireRow.FormatConditions.Add 2, , ActiveSheet.CheckBox1.Value
ActiveCell.EntireRow.FormatConditions(1).Interior.ColorIndex = 8
End Sub
[/GPECODE]
Code trên em tìm trên diễn đàn, lâu quá ko nhớ của ai.
Code trên hiện tại chỉ tô màu cho dòng khi checkbox được chọn. Nay em muốn cho nó tô màu luôn cột khi checkbox được chọn
P/s: Em có thể bổ sung thêm 2 dòng code
[GPECODE=vb]ActiveCell.EntireColumn.FormatConditions.Add 2, , ActiveSheet.CheckBox1.Value
ActiveCell.EntireColumn.FormatConditions(1).Interior.ColorIndex = 8
[/GPECODE]
đổi row thành column nhưng không được.
Rất mong được các anh chị giúp đỡ
