Script problem on excel spanish version

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

Guest

I have an excel macro under microsoft excel 2003 sp2 in spanish version that
have a strange behaviour.
the macro is this:

Sub Macro1()

Dim keyinizio As String
keyinizio = "START"

Dim myExcel As Object
Set myExcel = CreateObject("Excel.Application")

myExcel.Visible = True
myExcel.WindowState = -4143

myExcel.Workbooks.Add

myExcel.ActiveWorkbook.Names.Add Name:=keyinizio,
RefersToR1C1:="=Hoja1!R1C1:R1C1"

MsgBox myExcel.ActiveWorkbook.Names(1)

myExcel.Goto (keyinizio)

End Sub

The message box return this value: =Hoja1!'R1C1':Hoja1!'R1C1'

So the GoTo instruction rise an error "Run-time error 1004: not valid
reference"

The correct value that expect in ActiveWorkbook.Names should be =Hoja1!'$A$1'

This behaviour happend only spanish version, with the italin and english
version all works fine

Thanks

Giulio
 
Maybe it's the international differences that are used for R(ow) and C(olumn).

myExcel.ActiveWorkbook.Names.Add Name:=keyinizio, _
RefersTo:="=Hoja1!A1"

or just name the range itself.

worksheets("hoja1").range("a1").name = keyinizio
 

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