Thread: Macro Error
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Carl Carl is offline
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.