LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 143
Default Excel 2000 vs Excel 2003

Thanks, Alan.

That did it.

I did not realize that "ThisWorkbook" referenced the workbook that contained
the running VBA.

Since I open other workbooks while this VBA code runs, I thought I needed to
capture the workbook's name when I first opened the work book.

Ken



"Alan" wrote in message
...
"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.





 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2000 and Excel 2003 in Office 2003 Emon New Users to Excel 0 December 21st 06 09:11 AM
Upgrade from Excel 2000 to Excel 2003 without MS Office 2003? brigida3 Excel Discussion (Misc queries) 1 January 22nd 06 05:13 PM
Excel 2003 crashes loading excel files created Excel 2000 Jeff Lewin Australia Excel Discussion (Misc queries) 0 June 27th 05 04:20 AM
Excel 2000 VBA App Now Works in Excel 2003, but not Excel 2002 bobkaku Excel Programming 0 March 11th 05 02:07 AM
Excel 2003 won't run simple code that Excel XP and Excel 2000 will run Moses[_2_] Excel Programming 4 January 27th 05 06:30 AM


All times are GMT +1. The time now is 10:37 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"