View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Next For looping in a If

That is exactly what I gave you.

If you want something more obscene


Sub Demo()
Dim J As Long
For J = 1 To 10
' do something
If Cells(1, J).Value 2 Then GoTo Line3
' code to process the cell
Debug.Print J

Line3:
Next J
End Sub


Welcome to the 70's

--
Regards,
Tom Ogilvy

"Jean-Jerome Doucet via OfficeKB.com" wrote in message
...
Tom, I don't see how it solvesmy problem. It is a regular for next you
presented me here. I want to put a line code that specify in another place
(in the if) to do Next J with arriving to the official Next J. It the same
principle as Exit For, excepted that I don't want to exit but to go to the
next J.

Tom Ogilvy wrote:
Sub Demo()
Dim J As Long
For J = 1 To 10
' do something
If Cells(1,J).Value 2 then
' code to process the cell
End if
Next J
End Sub

Not exactly but you understand the way I think. I want to say Next and

not
exit

[quoted text clipped - 28 lines]

JJD



--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200507/1