View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
PaulD PaulD is offline
external usenet poster
 
Posts: 92
Default Visual Basic Help

You need to close your With sections with End With. Note inserted lines
below
Paul D

"John" wrote in message
...
: I am writing some code in a macro, that when a checkbox is checked, the
macro
: is run and will look at a cell to see if the word "TRUE" is in it. If it
is
: true, I want to turn the cell red. If it is not true, I want the cell to
be
: white. I am getting an else without if error. Below is the code, could
: someone help me?
:
: Sub us()
: '
: ' us Macro
: ' Macro recorded 12/22/2005 by
: '
:
: '
: If Range("M42") = "True" Then
: ActiveWindow.SmallScroll Down:=4
: Range("D42,D44,D46").Select
: Range("D46").Activate
: ActiveWindow.SmallScroll Down:=3
: Range("D42,D44,D46,D48,D50").Select
: Range("D50").Activate
: With Selection.Interior
: .ColorIndex = 3
: .Pattern = xlSolid
: .PatternColorIndex = xlAutomatic
End With '*****<--------
: Else
: ActiveWindow.SmallScroll Down:=4
: Range("D42,D44,D46").Select
: Range("D46").Activate
: ActiveWindow.SmallScroll Down:=3
: Range("D42,D44,D46,D48,D50").Select
: Range("D50").Activate
: With Selection.Interior
: .ColorIndex = 3
: .Pattern = xlSolid
: .PatternColorIndex = xlAutomatic
End With '*****<-----------
: End If
: End Sub
: