Macro Error

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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 here:

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.
 
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????
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top