본문 바로가기
  • Welcome!
VBA Code

Highlight Selected Column

by ToolBOX01 2023. 1. 9.
반응형
  Application.ScreenUpdating = False
     
     If Target.Cells.Count > 1 Then Exit Sub
 
     '// Clear the color of all cells
     Dim lastColumn As Integer
     lastColumn = Cells(15, Columns.Count).End(xlToLeft).Column
     
     Dim lasRow As Integer
     lasRow = Cells(Rows.Count, 16).End(xlUp).Row

     Range("A16:XFD1048576").Interior.ColorIndex = 0
     
     If Not Intersect(Target, Range(Cells(16, "A"), Cells(lasRow, lastColumn))) Is Nothing Then
     
        With Target
            
            '// Highlight row of the selected cell
            .EntireRow.Interior.ColorIndex = 38
            
            '// Highlight column of the selected cell
            '//.EntireColumn.Interior.ColorIndex = 24
            
        End With
        
      End If

 

프로그램 동작 화면

 

https://www.ablebits.com/office-addins-blog/highlight-active-row-column-excel/

 

How to highlight active row and column in Excel

3 ways to dynamically highlight the row and/or column of a selected cell in Excel.

www.ablebits.com

 

https://www.officetutor.co.kr/board/Dtype/bfrmvw.asp?f_tn=Dqa_excel_n2&f_bno=123981&page=5&fchk=&fval= 

 

오피스튜터 - 강좌: Worksheet _change 이벤트 핸들러 설계하기

오피스튜터 - 강좌: Worksheet _change 이벤트 핸들러 설계하기

www.officetutor.co.kr

참고 사이트

 

 

 

'VBA Code' 카테고리의 다른 글

진행률 표시  (0) 2023.01.19
with ~End With  (0) 2023.01.12
문자열 응용 하기  (0) 2023.01.01
Cells 값 비교 하기  (0) 2022.12.16
엑셀 셀 선택시 열,행 색상으로 표시하기  (0) 2022.12.14