View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Don Acree Don Acree is offline
external usenet poster
 
Posts: 1
Default using variable in

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