![]() |
Script problem on excel spanish version
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 |
Script problem on excel spanish version
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 Giulio wrote: 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 -- Dave Peterson |
All times are GMT +1. The time now is 01:58 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com