View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
achidsey achidsey is offline
external usenet poster
 
Posts: 100
Default Next if blank in For Each Loop


Excel Experts,

My spreadsheet is similar to the following:

1 2
A Symbol Div
B DELL 1.23
C IBM 0
D MSFT 1.50

For each symbol, if the amount in the Div column is not zero, I want to
perform a series of steps. If the amount is zero, I want to skip to the next
symbol.

In the code below, when I try to run it, Excel gives an error, highlights
the Next within the If statement and says I can not have a Next without a
For.

How do I edit this procedure to make it go to the next symbol if the amount
in the Div column is zero.

Sub AddDiv( )

Set Symbols = Range("B1:D1")

Set HDiv = Range("A2")

For Each Symbol in Symbols

If Cells(Symbol.Row, HDiv.Column).Value = 0 Then

Next Symbol

End If

(Rest of Procedure)

Next Symbol

End Sub

Thanks in advance,
Alan

--
achidsey