Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA Code works in Excel 2003 but won't work in Excel 2000


Hi, everyone.

Thanks in advance for your help. I've got a very simple piece of code
written for Excel 2003 that crashes on a computer running Excel 2000,
and I can't figure out what the issue is for the life of me. Any
assistance would be greatly appreciated -- no need to rewrite the
code;
just let me know what the offending piece is. The Excel 2000 user
says
when he gets the run-time error and clicks debug, it drops him on the
Sub xxx() line.

Thanks.

Aaron


Code:
--------------------
Sub CompetitorPg1to2()
Dim CompetitorNum As Integer
Dim NextShtNm As String

CompetitorNum = Left(ActiveSheet.Name, 1)

If CompetitorNum = 1 Then
NextShtNm = "1st Competitive set 2 of 2"
ElseIf CompetitorNum = 2 Then
NextShtNm = "2nd Competitive set 2 of 2"
ElseIf CompetitorNum = 3 Then
NextShtNm = "3rd Competitive set 2 of 2"
ElseIf CompetitorNum = 4 Then
NextShtNm = "4th Competitive set 2 of 2"
ElseIf CompetitorNum = 5 Then
NextShtNm = "5th Competitive set 2 of 2"
Else
MsgBox ("Page change error. Please contact the application
administrator.")
Exit Sub
End If

Call SwitchSheet(Sheets(NextShtNm))

End Sub

'----------------------

Sub SwitchSheet(aSht As Worksheet)
Application.ScreenUpdating = False
aSht.Visible = xlSheetVisible
ThisWorkbook.ActiveSheet.Visible = xlSheetHidden
aSht.Activate
aSht.Select
aSht.Range("A1").Select
Application.ScreenUpdating = True
End Sub
--------------------


--
aglazer
------------------------------------------------------------------------
aglazer's Profile: http://www.excelforum.com/member.php...o&userid=26975
View this thread: http://www.excelforum.com/showthread...hreadid=401871

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA Code works in Excel 2003 but won't work in Excel 2000


What's the error message? sounds like it might be a bad dim or compil
error. refer to the error.

you have a type mismatch - redimension your CompetitorNum as a string

--
gearo
-----------------------------------------------------------------------
gearoi's Profile: http://www.excelforum.com/member.php...fo&userid=2657
View this thread: http://www.excelforum.com/showthread.php?threadid=40187

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA Code works in Excel 2003 but won't work in Excel 2000


Thanks.

I've set CompetitorNum as both an Integer and a String; doesn't make
difference either way.

It compiles & runs fine in Excel 2003, and the code doesn't have a
Option Explicit, so it shouldn't be a Dim error.

I'll get the exact error message from the user and post it to see i
you have any additional thoughts.

Thanks,

Aaro

--
aglaze
-----------------------------------------------------------------------
aglazer's Profile: http://www.excelforum.com/member.php...fo&userid=2697
View this thread: http://www.excelforum.com/showthread.php?threadid=40187

Reply
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
#VALUE! error: vlookup works in Excel 2000 but not 2003 Nick Ersdown Excel Discussion (Misc queries) 6 November 25th 05 12:23 PM
VBA Code works in Excel 2003 but won't work in Excel 2000 [email protected] Excel Programming 0 September 5th 05 09:05 AM
Code works with Excel 2000 but not with Excel 2002 La Durande Excel Programming 0 September 17th 04 09:46 PM
Code works with Excel 2000 but not with Excel 2002 Tom Ogilvy Excel Programming 0 September 17th 04 09:21 PM
Code works with Excel 2000 but not with Excel 2002 La Durande Excel Programming 0 September 17th 04 08:49 PM


All times are GMT +1. The time now is 11:06 PM.

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"