![]() |
Macro Error
Hi. I have been using this macro:
For Each sh In SheetList I = I + 1 If Application.Range("SheetNames").Cells(I, 1).Value < "" Then With sh LastRow = .Range("a10").End(xlDown).Row LastCol = .Range("a10").End(xlToRight).Column Set RngToName = .Range("a10", .Cells(LastRow, LastCol)) RngToName.Name = Application.Range("SheetNames").Cells(I, 1).Value End With End If Next sh My company has recently migrated us from Windows2000/Excel2000 to WindowsXP/Excel2003. This macro worked fine before the migration. Now when I run it, it gets hung up he RngToName.Name = Application.Range("SheetNames").Cells(I, 1).Value. "Run Time Error / That Name Not Valid ". When I hover the mouse over the line of code it reads: <RngTo.Name=<Application-defined or object-defined error I am using VisualBasic 6.3. Can this be fixed ? Thank you in advance. |
Macro Error
Before I spent too much time debugging the code, I'd look to see what was in
that cell. Maybe it contains a value that can't be used as a name???? carl wrote: Hi. I have been using this macro: For Each sh In SheetList I = I + 1 If Application.Range("SheetNames").Cells(I, 1).Value < "" Then With sh LastRow = .Range("a10").End(xlDown).Row LastCol = .Range("a10").End(xlToRight).Column Set RngToName = .Range("a10", .Cells(LastRow, LastCol)) RngToName.Name = Application.Range("SheetNames").Cells(I, 1).Value End With End If Next sh My company has recently migrated us from Windows2000/Excel2000 to WindowsXP/Excel2003. This macro worked fine before the migration. Now when I run it, it gets hung up he RngToName.Name = Application.Range("SheetNames").Cells(I, 1).Value. "Run Time Error / That Name Not Valid ". When I hover the mouse over the line of code it reads: <RngTo.Name=<Application-defined or object-defined error I am using VisualBasic 6.3. Can this be fixed ? Thank you in advance. -- Dave Peterson |
All times are GMT +1. The time now is 10:26 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com