View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default using variable in

It is always a good idea to tell us what non-working code is supposed to be
doing. My gut feeling is this can be done with less code, but I am not
totally sure what you are ultimately trying to accomplish.

--
Rick (MVP - Excel)


"Don Acree" <Don wrote in message
...
I get a Runtime error '1004' when it encounters the last line here. I
guess
the program cannot understand the use of the variable "counter" in the
last
line.


Range("I1").Select
Selection.End(xlDown).Select
JobNumber = ActiveCell.Value
counter = 0
Do
ActiveCell.Offset(1, 0).Select
If ActiveCell.Value < JobNumber Then
ActiveCell.Offset(-1, 0).Select
Exit Do
End If
counter = counter - 1
Loop
ActiveCell.Offset(0, -1).Select
Selection.Resize(counter, 0).Select