• 根据Excel中的某一列的分别加颜色


       1:  Sub Macro1()
       2:       Dim i As Integer
       3:       Dim x As String
       4:       For i = 1 To Sheet1.UsedRange.Rows.Count
       5:          With Sheet1.Rows(i).Interior
       6:               x = Cells(i, 3)
       7:               If x = "是" Then
       8:                  Call Macro2(i, 3, 15773696)
       9:               ElseIf x = "否" Then
      10:                  Call Macro2(i, 3, 5296274)
      11:               End If
      12:           End With
      13:       Next
      14:   End Sub
      15:   
      16:  Sub Macro2(x As Integer, y As Integer, colorIndex As Long)
      17:      Range(Cells(x, y), Cells(x, y)).Select
      18:      With Selection.Interior
      19:          .Pattern = xlSolid
      20:          .PatternColorIndex = xlAutomatic
      21:          .color = colorIndex
      22:          .TintAndShade = 0
      23:          .PatternTintAndShade = 0
      24:      End With
      25:      Range("G18").Select
      26:  End Sub
      27:   
      28:   
      29:  
      30:  Sub Macro1()
      31:       Dim i As Long
      32:       Dim x As String
      33:       Columns(3).Interior.ColorIndex = xlNone
      34:       For i = 1 To Sheet1.UsedRange.Rows.Count
      35:          With Sheet1.Rows(i).Interior
      36:               x = Cells(i, 3)
      37:               If x = "是" Then
      38:               Cells(i, 3).Interior.ColorIndex = 5
      39:               End If
      40:           End With
      41:       Next
      42:   End Sub
  • 相关阅读:
    桶排序
    基数排序
    计数排序
    归并排序
    快速排序
    优先级队列-堆实现
    堆排序
    红黑树
    【转】二叉树
    ubuntu 16.04 mysql 相关
  • 原文地址:https://www.cnblogs.com/pnljs/p/2949695.html
Copyright © 2020-2023  润新知