View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Alan Alan is offline
external usenet poster
 
Posts: 188
Default Excel 2000 vs Excel 2003

"Ken Loomis" wrote in message
...

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


Hi Ken,

If Workbooks(1) is actually the workbook containing the sub, then you
could replace it with ThisWorkbook which might make it work okay:

ThisWorkbook.Worksheets("Progress").Range("A" & NextEmpty).Value =
CurrentSub


HTH,

Alan.