View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Vasant Nanavati Vasant Nanavati is offline
external usenet poster
 
Posts: 1,080
Default Using multiple conditions

You are missing an End If right after the End With.

--

Vasant

"John Keturi" wrote in message
news:G4cvc.40419$mm1.15189@fed1read06...
The following generates an error "Next" without a "For". What do I put in

so
that it formats the cell which corresponds to the following row & column
parameters?

For a = 4 To 31
If Cells(a, 1).Value = "John" Then
For b = 2 To 32
If Cells(2, b).Value = "Fri" Then
Cells(b, a).Select
With Selection.Interior
.ColorIndex = 0
.Pattern = xlGray8
.PatternColorIndex = xlAutomatic
End With
Next b
End If
Next a
MsgBox "Formatting Complete"
Exit Sub
Error:
Exit Sub
End Sub


Thanks