Excel: Give a cell as reference in a module


HI , I have a code for getting increasing numbers in a cell.... that is .....

 
Sub Count()
With ActiveSheet.Range("H7")
.Value = .Value + 1
Application.Wait (Now + TimeValue("00:00:01"))
ActiveSheet.PrintOut
If .Value >= 10 Then Exit Sub 'limit
End With
Application.OnTime Now + TimeValue("00:00:02"), "Count" 'every 2 seconds
End Sub
here in line 6 "If .Value >= 10 Then Exit Sub 'limit" i want to replace the value 10 by a cell reference in a sheet within the same work book so it can take the value " limit" from a cell. Advance thanks.


This question generated 8 answers. To proceed to the answers, click here.

This thread is current as of September 29, 2014.


For more resources for Microsoft Excel