S
Sam
keep getting the error message
Compile error: Else without If
Sub STEP1()
Dim FromWbook As Worksheet
Dim myCell As Range
Dim myRng1 As Range
Set FromWbook = Workbooks("Copy of 222.xls").Worksheets("Sheet2")
With FromWbook
Set myRng1 = .Range("E11:E71")
End With
For Each myCell In myRng1.Cells
If myCell.Value >= myCell.Offset(3, 0) Then
myCell.Offset(0, 1).Value = 1
myCell.Offset(0, 1).Select
myCell.Offset(0, 1).Font.ColorIndex = 4
With Selection.Interior
.ColorIndex = 1
.Pattern = xlSolid
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
ElseIf myCell.Value < myCell.Offset(3, 0) Then
myCell.Offset(0, 1).Value = 1
myCell.Offset(0, 1).Select
myCell.Offset(0, 1).Font.ColorIndex = 4
With Selection.Interior
.ColorIndex = 1
.Pattern = xlSolid
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Else
End If
Next myCell
End Sub
Compile error: Else without If
Sub STEP1()
Dim FromWbook As Worksheet
Dim myCell As Range
Dim myRng1 As Range
Set FromWbook = Workbooks("Copy of 222.xls").Worksheets("Sheet2")
With FromWbook
Set myRng1 = .Range("E11:E71")
End With
For Each myCell In myRng1.Cells
If myCell.Value >= myCell.Offset(3, 0) Then
myCell.Offset(0, 1).Value = 1
myCell.Offset(0, 1).Select
myCell.Offset(0, 1).Font.ColorIndex = 4
With Selection.Interior
.ColorIndex = 1
.Pattern = xlSolid
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
ElseIf myCell.Value < myCell.Offset(3, 0) Then
myCell.Offset(0, 1).Value = 1
myCell.Offset(0, 1).Select
myCell.Offset(0, 1).Font.ColorIndex = 4
With Selection.Interior
.ColorIndex = 1
.Pattern = xlSolid
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Else
End If
Next myCell
End Sub