View Single Post
  #1  
Old 01-09-2009, 05:50 PM
mewingkitty's Avatar
mewingkitty mewingkitty is offline
Valued Forum Contributor
 
Join Date: 29 Sep 2008
Location: Grande Prairie, Alberta, Canada
MS Office Version:Excel 2007
Posts: 902
mewingkitty has an addiction to Excel
Send a message via MSN to mewingkitty Send a message via Yahoo to mewingkitty
FOR, IF, NEXT... Error in VBA while attempting a simple code.

Me again, still plugging away at VBA.
Had a bit of code I was working on for a guy on here, and came across a problem while putting the finishing touches on it. It's since been solved by someone else, but for future reference...

Code:
Dim iFor As Integer

For iFor = 1 To 10

    If Cells(1, 1) = 1 Then
    Next iFor
    Else
    Cells(1, 2) = 2
    End If
    
Next iFor
    
End Sub
This obviously isn't a functional code in its current state, but it does work of the - Next iFor - is something else, such as - cells(1, 2) = 3

Just wondering why it is everything else seems to work with IF this way, but NEXT keeps getting me errors.

Thanks!
__________________
=IF(AND(OR(BLONDE,BRUNETTE,REDHEAD),OR(MY PLACE,HER PLACE),ME),BOW-CHICKA-BOW-WOW,ANOTHER NIGHT ON THE INTERNET)

Last edited by mewingkitty; 01-09-2009 at 06:55 PM.
Reply With Quote