View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rowan[_2_] Rowan[_2_] is offline
external usenet poster
 
Posts: 226
Default Excel 2000 vs Excel 2003

If you are not using rng for anything else you could try:

Sub MarkSub(CurrentSub As String)
Dim NextEmpty As Long

NextEmpty = Workbooks(1).Sheets("Progress"). _
Cells(Rows.Count, 1).End(xlUp).Row + 1

Workbooks(1).Worksheets("Progress"). _
Range("A" & NextEmpty).Value = CurrentSub

End Sub

Hope this helps
Rowan

"Ken Loomis" wrote:

I can use this sub on Excel 2003 (11) and it runs fine:

Sub MarkSub(CurrentSub As String)
Dim rng As Range
Dim NextEmpty As Integer

' The next line is where the error occurs
Set rng = Workbooks(1).Sheets("Progress").Cells(Rows.count, 1).End(xlUp)

NextEmpty = rng.Row + 1
Workbooks(1).Worksheets("Progress").Range("A" & NextEmpty).Value =
CurrentSub

End Sub


However, when it is run on Excel 2000 (9), it gives a error at the line I
commented above. I was told it was an out of range error.

Can anyone suggest a workaround?

TIA,
Ken