#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 361
Default 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.



  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default 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
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
Macro Help (Uppercase multiple ranges?) Ken Excel Discussion (Misc queries) 14 December 2nd 06 07:23 PM
MS Visual Basic Error...from MAcro G118 Excel Discussion (Misc queries) 0 December 12th 05 05:56 PM
Macro time out error mike b Excel Worksheet Functions 1 December 10th 05 05:21 PM
Macro / Compile Error / Duplicate Declaration carl Excel Worksheet Functions 1 June 29th 05 08:55 PM
Runtime error for macro that works in workbook created in Crystal Excel Discussion (Misc queries) 1 June 22nd 05 08:43 PM


All times are GMT +1. The time now is 03:51 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"