View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Cone Jim Cone is offline
external usenet poster
 
Posts: 3,290
Default Named range by VBA to another workbook


You are missing the line continuation character: "_" (an underscore).
RefersTo:=SDR.Range((Cells(1, I)), Cells(20000, I)), _
Visible:=True
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



"Madiya" wrote in message ups.com...
Hi,
I am trying to set named range by VBA to another workbook.
Dim LR As Integer
Dim I As Integer
Dim J As Integer
Dim WRM As Workbook
Dim SDR As Worksheet

Set WRM = Workbooks("RUIM new.xls")
Set SDR = WRM.Sheets("Damage Receipt")
For I = 1 To 12
ActiveWorkbook.Names.Add Name:=SDR.Cells(1, I).Value, _
RefersTo:=SDR.Range((Cells(1, I)), Cells(20000, I)),
Visible:=True <<<ERROR
Next

I am getting error on the above statement.
Need help.
Regards,
Madiya