How do I tied this If Else statements into the For Each? This is what I want to do but am unable to write it correctly.. Any help would be appreciated.
VB Code:
For Each MyCell In Sheet1.Columns("J").Cells With MyCell If .Value < "04/30/2006" Then For Each MyCell In Sheet1.Columns("A").Cells With MyCell If .Value = "" Then Exit For If .Value = 574 _ Or .Value = 555 _ Or .Value = 510 Then .Offset(0, 12).Value = .Offset(0, 8).Value * 1.1 Else For Each MyCell In Sheet1.Columns("D").Cells With MyCell If .Value <> "OMI" Then .Offset(0, 12).Value = .Offset(0, 8).Value * 1.4503 Else .Offset(0, 12).Value = .Offset(0, 8).Value End If End With Next MyCell End If End With Next MyCell Else If .Value > "04/30/2006" Then For Each MyCell In Sheet1.Columns("A").Cells With MyCell If .Value = "" Then Exit For If .Value = 574 _ Or .Value = 555 _ Or .Value = 510 Then .Offset(0, 12).Value = .Offset(0, 8).Value * 1.2 'change later Else For Each MyCell In Sheet1.Columns("D").Cells With MyCell If .Value <> "OMI" Then .Offset(0, 12).Value = .Offset(0, 8).Value * 1.5 ' change later Else .Offset(0, 12).Value = .Offset(0, 8).Value End If End With Next MyCell End If End With Next MyCell End If End With Next MyCell End Sub




Reply With Quote