Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub AddDiv( )
dim Symbols as Range dim HDiv as range Set Symbols = Range("B1:D1") Set HDiv = Range("A2") For Each Symbol in Symbols If Cells(Symbol.Row, HDiv.Column).Value = 0 Then 'skip it else (Rest of Procedure) end if Next Symbol End Sub achidsey wrote: 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 -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Paste blank cell row loop | Excel Programming | |||
Advancing outer Loop Based on criteria of inner loop | Excel Programming | |||
Problem adding charts using Do-Loop Until loop | Excel Programming | |||
Excel VBA - Repeat for loop until blank rows | Excel Programming | |||
get for loop to go on after blank cell? | Excel Programming |