I originally had a macro written that would clear the specified cells in an excel sheet but I want to be able to only clear certain rows if I need to. This is what my macro looks like currently.
Sub Rectangle1_Click()
response = MsgBox("Are You Sure?", vbYesNo
If response = vbNo Then
MsgBox ("OK")
Exit Sub
End If
Range("A4:C30").Select
Selection.ClearContents
Range("G4:H30").Select
Selection.ClearContents
End Sub
I'm wanting to make it look something more like this though
Sub Rectangle1_Click()
response = MsgBox("Are You Sure?", vbYesNo)
If response = vbNo Then
MsgBox ("OK")
Exit Sub
End If
If I4 = 1 then
Range("A4:C4","G4:H4").Select
Selection.ClearContents
Exit Sub
End If
End Sub
And then repeat that code for rows 5-30, when I run the code with multiple if statements it doesn't appear to do anything after the dialogue box pops up. Is there something else that I need to change?