Sub 행배경색채우기()
'
' 행배경색채우기 매크로
'
' 바로 가기 키: Ctrl+r
'
    
    Dim rowno1 As Integer, rowno2 As Integer
    Dim con As String
    rowno1 = Val(InputBox("배경색을 지정할 행의 배수 값을 숫자로 입력해주세요", "숫자 입력창", 2))
    rowno2 = rowno1 * 2
    con = "=AND(MOD(ROW(A1)," & rowno2 & ")>=1,MOD(ROW(A1)," & rowno2 & ")<=" & rowno1 & ")"
    
    행배경색지우기
    
    Range("A3").Select
    Range(Selection, Selection.End(xlToRight)).Select
    Range(Selection, Selection.End(xlDown)).Select
    
    Selection.FormatConditions.Add Type:=xlExpression, Formula1:=con
       
    Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
    With Selection.FormatConditions(1).Interior
        .PatternColorIndex = xlAutomatic
        .ThemeColor = xlThemeColorAccent5
        .TintAndShade = 0.799981688894314
    End With
    
    Range("A1").Select
End Sub


Sub 행배경색지우기()
'
' 행배경색지우기 매크로
'

'
    Range("A3").Select
    Range(Selection, Selection.End(xlToRight)).Select
    Range(Selection, Selection.End(xlDown)).Select
   
    Selection.FormatConditions.Delete
    Range("A1").Select
End Sub
