Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Error in 2003 which is not in 2000

Please help.

When I type the following code and run in excel 2003, I get error "subscript out of range" runtime error 9. This is not there for the same code in 2000. How to resolve this.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim tmpWB As Workbook
Set tmpWB = Workbooks.Open("C:\Program Files\General Electric\DFSS Process\Databases9.14.98\208.Face-Centered_CCD.table", 0, True, 2)
Dim tmpSheet As New Worksheet
Dim s As String
s = Left("208.Face-Centered_CCD.table", 31)
MsgBox s
Set tmpSheet = Sheets(Left("208.Face-Centered_CCD.table", 31))
MsgBox tmpSheet.Name
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Error in 2003 which is not in 2000

You apparently don't have a worksheet with the name
208.Face-Centered_CCD.table

Perhaps it has a space on the end or something.

also, why do you try to take the leftmost 31 characters from a string of
length 27?

--
Regards,
Tom Ogilvy

"Laks" wrote in message
...
Please help.

When I type the following code and run in excel 2003, I get error

"subscript out of range" runtime error 9. This is not there for the same
code in 2000. How to resolve this.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim tmpWB As Workbook
Set tmpWB = Workbooks.Open("C:\Program Files\General Electric\DFSS

Process\Databases9.14.98\208.Face-Centered_CCD.table", 0, True, 2)
Dim tmpSheet As New Worksheet
Dim s As String
s = Left("208.Face-Centered_CCD.table", 31)
MsgBox s
Set tmpSheet = Sheets(Left("208.Face-Centered_CCD.table", 31))
MsgBox tmpSheet.Name
End Sub



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
Strange 'protected cell' error affecting Excel 2003 but not Excel 2000? Pheasant Plucker® Excel Discussion (Misc queries) 1 April 10th 07 01:04 PM
Pie chart built in 2000, now in 2003 but unable to edit 2003-way Judith Rempel Excel Discussion (Misc queries) 0 September 21st 06 12:05 AM
Error Checking Options - 2000-2003 brianbishop Excel Discussion (Misc queries) 1 August 11th 06 09:33 PM
Macro error after switching from Excel 2000 to Excel 2003 Jake Burnham Excel Discussion (Misc queries) 1 January 10th 06 08:10 PM
#VALUE! error: vlookup works in Excel 2000 but not 2003 Nick Ersdown Excel Discussion (Misc queries) 6 November 25th 05 12:23 PM


All times are GMT +1. The time now is 03:58 AM.

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

About Us

"It's about Microsoft Excel"