![]() |
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 |
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 |
All times are GMT +1. The time now is 09:33 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com