# 當點選時該列變色指引 依第一列 當點選時該列變色指引 有效資料筆數+200內有正常作用 巨集需在工作表內 ``` vb Private Sub Worksheet_SelectionChange(ByVal Target As Range) Application.EnableEvents = False '暫時停止事件觸發 '選到的那一列變更底色 yk = Cells(Rows.Count, 1).End(xlUp).Row '最後一列 y = Target.Row X = Target.Column colnum = Cells(1, Columns.Count).End(xlToLeft).Column '最後一欄 If colnum > 27 Then colunm = 26 If colnum < 6 Then colunm = 6 Code = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ccode = Mid(Code, colnum, 1) Range("A2:" & ccode & yk+200).Interior.Pattern = xlNone Range("A2" & y & ":" & ccode & y).Interior.ThemeColor = 8 Application.EnableEvents = True '暫時停止事件觸發 End Sub
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up