View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Peter T[_3_] Peter T[_3_] is offline
external usenet poster
 
Posts: 81
Default Adding named range gives error "method range of object _Global failed "

Try the same code in -

Sub Auto_Open() 'in a normal module

regards,
Peter


It Is caused by a badly qualified raference and that

excel doesn't release
it unitl restart excel. " a line of code that calls an

Excel object, method,
or property without qualifying it with an Excel object

variable ",

OBS - In ThisWorkbook module !

Public Sub Workbook_Open()
ActiveWorkbook.Names.Add Name:="Sh104Rng",
RefersTo:=Sheet1.Range("C29:G48,C52:G71,C75:G94") ,

Visible:=True
End Sub

It worked well one time - sometime even two - just as

Microsoft tell us.
Some other time, the problem seem to be reproduced

directly when I shoosed
the expression "Name" in Watch Window in VBA interface.