ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA Code works in Excel 2003 but won't work in Excel 2000 (https://www.excelbanter.com/excel-programming/339185-vba-code-works-excel-2003-but-wont-work-excel-2000-a.html)

[email protected]

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

---

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



All times are GMT +1. The time now is 01:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com