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

[µo°Ý] ¦Û°Ê¤W©³¦â»P¦r¦â ¨Ã¦Û°Ê½Õ¾ã¤Ï®t©ö©óÃѧO

[µo°Ý] ¦Û°Ê¤W©³¦â»P¦r¦â ¨Ã¦Û°Ê½Õ¾ã¤Ï®t©ö©óÃѧO

¦U¦ì«e½ú¦n
¤µ¤Ñ½Ð±Ð©³¦â»P¦r¦âªº°ÝÃD
1.¥Ñ©ó¸û·sª©excelªº©³¦â¦r¦â³]©w¤ñ¸û¦h¼Ë©Ê!§Æ±æ¯à¦Û°ÊÅý©³¦â¦r¦â³]©w¦Û°Ê½Õ¾ã¤Ï®t©ö©óÃѧO
2.¥H¤U¥H Interior_ColorIndex ¤è¦¡ ªí¹FÃD·N!
3.½Ð±Ð¦U¦ì«e½ú¦³¤°»ò¤è¦¡¥i¥H Interior_Colorªº¤è¦¡³]©w©³¦â¤è¦¡,¤]¥i¥H¦Û°ÊÅý©³¦â¦r¦â³]©w¦Û°Ê½Õ¾ã¤Ï®t?
¦]¬°ÃC¦â¸¹ºØÃþ¤Ó¦h¤F! ¦³¤°»ò³W«h¥i´`¶Ü?
20221110.zip (56.09 KB)

­ì©l¸ê®Æ:


Interior_ColorIndex ¤è¦¡µ²ªG:


Interior_Color¤è¦¡³]©w©³¦â .²`©³¦âªº¦rÁÙ¨SÅÜ¥Õ¦â:


Option Explicit
Sub Interior_ColorIndex()
Dim Arr, R&, C&, Sh, Brr, Crr, i&, x&, Y, T, Zn, N
Set Y = CreateObject("Scripting.Dictionary")
T = Timer
Set Sh = Sheets("¾Þ§@ªí")
R = Sh.UsedRange.EntireRow.Rows.Count
C = Sh.UsedRange.EntireColumn.Columns.Count
Arr = Range(Sh.[A1], Sh.Cells(R, C))
For i = 1 To R
   Zn = Arr(i, 1)
   If Y.Exists(Zn) = 0 Then
     N = N + 1
     Y(Zn) = N
   End If
   Sh.Cells(i, 1).Interior.ColorIndex = Y(Zn)
   If InStr("/1/3/5/9/10/11/12/13/18/21/23/25/26/29/30/31/32/41/47/49/51/52/53/54/55/56/", "/" & Y(Zn) & "/") Then
      Sh.Cells(i, 1).Font.ColorIndex = 2
   End If
Next
End Sub

Option Explicit
Sub Interior_Color()
Dim Arr, R&, C&, Sh, Brr, Crr, i&, x&, Y, T, Zn, N
Set Y = CreateObject("Scripting.Dictionary")
T = Timer
Set Sh = Sheets("¾Þ§@ªí")
R = Sh.UsedRange.EntireRow.Rows.Count
C = Sh.UsedRange.EntireColumn.Columns.Count
Arr = Range(Sh.[A1], Sh.Cells(R, C))
For i = 1 To R
   Zn = Arr(i, 1)
   If Y.Exists(Zn) = 0 Then
     N = N + 100000
     Y(Zn) = N
   End If
   Sh.Cells(i, 1).Interior.Color = Y(Zn)
Next
End Sub

¥»©«³Ì«á¥Ñ Andy2483 ©ó 2022-11-11 12:04 ½s¿è

ÁÂÁ¦U¦ì«e½ú
§ä¨ì¤èªk:


Option Explicit
Sub Interior_Color()
Dim Arr, R&, C&, Sh, Brr, Crr, i&, X&, Y, T, Zn, N
Set Y = CreateObject("Scripting.Dictionary")
T = Timer
Set Sh = Sheets("¾Þ§@ªí")
R = Sh.UsedRange.EntireRow.Rows.Count
C = Sh.UsedRange.EntireColumn.Columns.Count
Arr = Range(Sh.[A1], Sh.Cells(R, C))
For i = 1 To R
   Zn = Arr(i, 1)
   If Y.Exists(Zn) = 0 Then
     N = N + 100000
     Y(Zn) = N
   End If
   Sh.Cells(i, 1).Interior.Color = Y(Zn)
   Y(Zn) = Sh.Cells(i, 1).Interior.ColorIndex
   If InStr("/1/3/5/9/10/11/12/13/18/21/23/25/26/29/30/31/32/41/47/49/51/52/53/54/55/56/", "/" & Y(Zn) & "/") Then
      Sh.Cells(i, 1).Font.ColorIndex = 2
   End If

Next
End Sub
«á¾Ç¸£µ¬²Â²Âªº!

TOP

¦^´_ 2# Andy2483


    Sorry!°ª¿³¹LÀY¤F!«á­±ªº©³¦â³£¿ù¤F!

­×¥¿:¦A¦h¥Î¤@­ÓÅܼÆ

Option Explicit
Sub Interior_Color()
Dim Arr, R&, C&, Sh, Brr, Crr, i&, X&, Y, T, Zn, N
Set Y = CreateObject("Scripting.Dictionary")
T = Timer
Set Sh = Sheets("¾Þ§@ªí")
R = Sh.UsedRange.EntireRow.Rows.Count
C = Sh.UsedRange.EntireColumn.Columns.Count
Arr = Range(Sh.[A1], Sh.Cells(R, C))
For i = 1 To R
   Zn = Arr(i, 1)
   If Y.Exists(Zn) = 0 Then
     N = N + 100000
     Y(Zn) = N
   End If
   Sh.Cells(i, 1).Interior.Color = Y(Zn)
   X = Sh.Cells(i, 1).Interior.ColorIndex
   If InStr("/1/3/5/9/10/11/12/13/18/21/23/25/26/29/30/31/32/41/47/49/51/52/53/54/55/56/", "/" & X & "/") Then
      Sh.Cells(i, 1).Font.ColorIndex = 2
   End If

Next
End Sub

TOP

¹ï¤ñ¦âªº­pºâ°ÝÃD,google¨Óªº°Ñ¼Æ
Sub test()
    With Sheets("¾Þ§@ªí")
        For i = 1 To 5000
            .Cells(i, 1).Font.Color = -vbWhite * (77 * (.Cells(i, 1).Interior.Color Mod &H100) + 151 * ((.Cells(i, 1).Interior.Color \ &H100) Mod &H100) + 28 * ((.Cells(i, 1).Interior.Color \ &H10000) Mod &H100) < 32640)
        Next i
    End With
End Sub

TOP

¦^´_ 4# quickfixer


    ÁÂÁ«e½ú«ü¾É
¥H¤U¬O°õ¦æ¹L»¡©ú»P¤ß±oµù¸Ñ:
°õ¦æ«e:


°õ¦æµ²ªG:


Sub test_quickfixer()
Dim i
    With Sheets("¾Þ§@ªí")
        For i = 1 To 5000
            .Cells(i, 1).Font.Color = -vbWhite * (77 * (.Cells(i, 1).Interior.Color Mod &H100) + 151 * ((.Cells(i, 1).Interior.Color \ &H100) Mod &H100) + 28 * ((.Cells(i, 1).Interior.Color \ &H10000) Mod &H100) < 32640)
            '¡ôÀx¦s®æ¦r¦â = (-1) * ¥Õ¦â¦â±m±`¼Æ16777215 * §PÂ_¦¡( TURE=1 ,FALSE=0 )
            '³o§PÂ_¦¡¤£ª¾¹D¦p¦ó¸ÑŪ ??
            
            '¤£¹L¾Ç¨ì«Ü¦hª¾ÃÑ"
            '1.&H100:¬O¤@­Ó±`¼Æ 256
            '2.&H10000:¬O¤@­Ó±`¼Æ 65536
            '3..Cells(i, 1).Interior.Color / &H100=390.625 ,.Cells(i, 1).Interior.Color \ &H100=390
            '²Ä¤@¦¸¾Ç²ß¨ì ¹Bºâ¦¡¸Ì \ = Int( / ) :°£¦¡ªº°Ó¥h§À ¨ú¾ã¼Æ

        Next i
    End With
End Sub

TOP

        ÀR«ä¦Û¦b : ¡i®É¶¡¦¨´N¤@¤Á¡j®É¶¡¥i¥H³y´N¤H®æ¡A¥i¥H¦¨´N¨Æ·~¡A¤]¥i¥HÀx¿n¥\¼w¡C
ªð¦^¦Cªí ¤W¤@¥DÃD