Excel의 특정 열에 따라 색상 추가

4360 단어 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

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

좋은 웹페이지 즐겨찾기