View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gord Dibben
 
Posts: n/a
Default How easy is it to loop in VBA based on cell contents?

Shouldn't it read?

If J < 1 Then

You wanted to iterate if A1 was 1 and not if something else.


Gord Dibben Excel MVP

On Fri, 25 Nov 2005 01:11:09 GMT, "Lee Harris" wrote:


"Gary''s Student" wrote in message
...
How about:

Sub Macro1()
For i = 1 To 37
j = Sheets("Sheet3").Range("A1").Value
If j = 1 Then
Exit For
Else
Application.Calculate
End If
Next
End Sub

--
Gary's Student



thanks, that looks great, I just wasn't sure what the syntax was though I
guessed the approximate format!