ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

Àx¦s¦U¨ú±oµJÂI«á¬Y¤@Äæ¦ìÅܦâ

Àx¦s¦U¨ú±oµJÂI«á¬Y¤@Äæ¦ìÅܦâ

½Ð°Ý¦U¦ì¤j¤j
¤ñ¤èÂI¤FAR212Äæ¦ì
AG212©³¦â·|ÅÜ
­n«ç³]­p©O
ÁÂÁÂ

¦^´_ 1# coafort
¤u§@ªí¼Ò²Õ¤U´Ó¤J:
Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
With Target
   If Replace(Split(.Address, "$")(1), ":", "") = "AR" Then
      Me.UsedRange.EntireColumn.Interior.ColorIndex = xlNone
      '¡ô¥O¥»ªí¨Ï¥Î®æªº¾ãÄ橳¦â¬°µL¦â
      .Offset(, -11).Interior.ColorIndex = 6
      '¡ô¥O¤@¶}©l¿ï¨ú®æ¬OARÄæÀx¦s®æ½d³òªº¥ª°¼11ÄæÀx¦s®æ©³¦â¬O¶À¦â
   End If
End With
End Sub
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¥»©«³Ì«á¥Ñ coafort ©ó 2024-2-1 17:38 ½s¿è
¦^´_  coafort
¤u§@ªí¼Ò²Õ¤U´Ó¤J:
Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Targ ...
Andy2483 µoªí©ó 2024-2-1 14:23


½Ð°Ý¤j¤j
¥Î¤F¤§«á­ì¨ÓªºÃC¦â³£¨S¤F
ÁÂÁÂ

TOP

¥»©«³Ì«á¥Ñ Andy2483 ©ó 2024-2-1 19:05 ½s¿è

¦^´_ 3# coafort

¤u§@ªí¼Ò²Õ¤U´Ó¤J:
Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
With Target
   If Replace(Split(.Address, "$")(1), ":", "") = "AR" Then
      .Offset(, -11).EntireColumn.Interior.ColorIndex = xlNone
      '¡ô¥OAGÄæ¾ãÄ橳¦â¬°µL¦â
      .Offset(, -11).Interior.ColorIndex = 6
      '¡ô¥O¤@¶}©l¿ï¨ú®æ¬OARÄæÀx¦s®æ½d³òªº¥ª°¼11ÄæÀx¦s®æ©³¦â¬O¶À¦â
   End If
End With
End Sub
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¦^´_  coafort



¦^´_ 1# coafort
¤u§@ªí¼Ò²Õ¤U´Ó¤J:
Option Explicit
Private Sub Worksheet_Sel ...
Andy2483 µoªí©ó 2024-2-1 18:29


ÁÂÁ¤j¤j
½Ð°Ý¦³¿ìªk«O¯d­ì¦³Ä檺ÃC¦â¶Ü¡H

TOP

¥»©«³Ì«á¥Ñ Andy2483 ©ó 2024-2-1 19:07 ½s¿è

¦^´_ 5# coafort

¤u§@ªí¼Ò²Õ¤U´Ó¤J:
Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
With Target
   If Replace(Split(.Address, "$")(1), ":", "") = "AR" Then
      .Offset(, -11).Interior.ColorIndex = 6
      '¡ô¥O¤@¶}©l¿ï¨ú®æ¬OARÄæÀx¦s®æ½d³òªº¥ª°¼11ÄæÀx¦s®æ©³¦â¬O¶À¦â
   End If
End With
End Sub
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¦^´_  coafort

¤u§@ªí¼Ò²Õ¤U´Ó¤J:
Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Ta ...
Andy2483 µoªí©ó 2024-2-1 18:57


³ø§i¤j¤j
Â÷¶}«á¶À©³¤£·|®ø¥¢­C
ÁÂÁ¤j¤j

TOP

¦^´_ 7# coafort


Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim a as Range
With Target
   For Each a in Intersect([AG:AG],Me.UsedRange)
      If a.interior.Colorindex=6 Then a.interior.colorindex=xlnone
   Next
   If Replace(Split(.Address, "$")(1), ":", "") = "AR" Then
      .Offset(, -11).Interior.ColorIndex = 6
      '¡ô¥O¤@¶}©l¿ï¨ú®æ¬OARÄæÀx¦s®æ½d³òªº¥ª°¼11ÄæÀx¦s®æ©³¦â¬O¶À¦â
   End If
End With
End Sub
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

https://stackoverflow.com/questions/58282085/change-cell-color-when-it-selected-and-back-original-color-after-leaving-it

¼Ó¥D­nªºÀ³¸Ó¬O³o­Ó¥\¯à

TOP

¥»©«³Ì«á¥Ñ quickfixer ©ó 2024-2-2 07:56 ½s¿è

¦^´_ 9# quickfixer


    ¸Ó¦ì§@ªÌªºµ{¦¡½X¦³2­Ó°ÝÃD

µ{¦¡°õ¦æ¤¤,µLªk­×§ïÃC¦â
µ{¦¡¶}ÀY¥[¤Jif, cc ¬Ý­n¤£­n¥Î¬Y­Ócell¥N´À
cc = "ÃC¦â¥i­×§ï"
If cc = "ÃC¦â¥i­×§ï" Then Exit Sub

¿ï¨úÄæ¦ì·|§âµLÃöªº¦C¼Æ¥þ³¡©ñ¤J°}¦C,¤]¤£¯à¿ï¾ã­Ó¤u§@ªí,µ{¦¡·|lag¶W¤[
²³æ¥[­Ó­­¨î,¥i¿ï¨úªº¦C¤W­­100,Äæ¤W­­26,³o­n¬Ý¹q¸£®Ä¯à­×§ï

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Static rngcolor As Range
    Static OldColor As Variant
    Dim rw As Long, cl As Long
   
    'cc = "ÃC¦â¥i­×§ï"
    If cc = "ÃC¦â¥i­×§ï" Then Exit Sub
    If Target.Columns.Count > 26 Then Exit Sub
     
    If Not rngcolor Is Nothing Then
        If IsArray(OldColor) Then
            On Error GoTo NoRestore
            For rw = 1 To rngcolor.Rows.Count
                For cl = 1 To rngcolor.Columns.Count
                    If IsEmpty(OldColor(rw, cl)) Then
                        rngcolor.Cells(rw, cl).Interior.ColorIndex = xlNone
                    Else
                        rngcolor.Cells(rw, cl).Interior.Color = OldColor(rw, cl)
                    End If
                Next
            Next
            On Error GoTo 0
        Else
            If IsEmpty(OldColor) Then
                rngcolor.Interior.ColorIndex = xlNone
            Else
                rngcolor.Interior.Color = OldColor
            End If
        End If
    End If
NoRestore:
    On Error GoTo 0

   
   
    If Target.Rows.Count > 100 Then nr = 100 Else nr = Target.Rows.Count
    Set rngcolor = Target.Resize(nr)
   
   
    ReDim OldColor(1 To nr, 1 To Target.Columns.Count)
    For rw = 1 To nr
        For cl = 1 To Target.Columns.Count
            If Target.Cells(rw, cl).Interior.ColorIndex = xlNone Then
                OldColor(rw, cl) = Empty
            Else
                OldColor(rw, cl) = Target.Cells(rw, cl).Interior.Color
            End If
        Next
    Next
    rngcolor.Interior.Color = vbYellow
End Sub

TOP

        ÀR«ä¦Û¦b : ÁÀ¨¥¹³¤@¦·²±¶}ªºÂAªá¡A¥~ªí¬üÄR¡A¥Í©Rµu¼È¡C
ªð¦^¦Cªí ¤W¤@¥DÃD