ego.bizzin
Thành viên chính thức
- Tham gia
- 18/4/13
- Bài viết
- 92
- Được thích
- 78
' TAGS : 2014-05-04, EB.GPE, chia sẻ, hàm tự tạo, share, UDF, UDS, tô sáng, đánh dấu, hàng, cột, highlight, column, row
[gpecode=vb]
' Tham khảo thêm tại
' http://www.giaiphapexcel.com/forum/archive/index.php/t-36986.html
Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Static rr
Static cc
If cc <> "" Then
With Columns(cc).Interior
.ColorIndex = xlNone
End With
With Rows(rr).Interior
.ColorIndex = xlNone
End With
End If
r = Selection.Row
c = Selection.Column
rr = r
cc = c
' Bắt đầu tô đoạn mã tô sáng cột
With Columns(c).Interior
.ColorIndex = 6 'Chọn màu
.Pattern = xlSolid
End With 'Kết thúc đoạn mã tô sáng cột
' Bắt đầu đoạn mã tô sáng hàng
With Rows(r).Interior
.ColorIndex = 6 'Chọn màu
.Pattern = xlSolid
End With 'Kết thúc đoạn mã tô sáng hàng
End Sub
[/gpecode]
[gpecode=vb]
' Tham khảo thêm tại
' http://www.giaiphapexcel.com/forum/archive/index.php/t-36986.html
Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Static rr
Static cc
If cc <> "" Then
With Columns(cc).Interior
.ColorIndex = xlNone
End With
With Rows(rr).Interior
.ColorIndex = xlNone
End With
End If
r = Selection.Row
c = Selection.Column
rr = r
cc = c
' Bắt đầu tô đoạn mã tô sáng cột
With Columns(c).Interior
.ColorIndex = 6 'Chọn màu
.Pattern = xlSolid
End With 'Kết thúc đoạn mã tô sáng cột
' Bắt đầu đoạn mã tô sáng hàng
With Rows(r).Interior
.ColorIndex = 6 'Chọn màu
.Pattern = xlSolid
End With 'Kết thúc đoạn mã tô sáng hàng
End Sub
[/gpecode]
Lần chỉnh sửa cuối: