Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 239
Default Named range by VBA to another workbook

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 239
Default Named range by VBA to another workbook

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

"Madiya" wrote in oglegroups.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


Thanks for your reply.
Actually this is google error.
I have got the whole line from refers upto visible in the same line in
VBA.
There is something else very simple and obvious which I am missing.
But thanks for your help. Pl let me know if you have any other
thought.

Regards,
Madiya

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 239
Default Named range by VBA to another workbook

On Aug 1, 4:39 am, Madiya wrote:
On Aug 1, 3:21 am, "Jim Cone" wrote:





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


"Madiya" wrote in oglegroups.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


Thanks for your reply.
Actually this is google error.
I have got the whole line from refers upto visible in the same line in
VBA.
There is something else very simple and obvious which I am missing.
But thanks for your help. Pl let me know if you have any other
thought.

Regards,
Madiya- Hide quoted text -

- Show quoted text -


Hi Jim,

Got the error.
The name is not valid (name should not contain any blank cherecter).
Is there any way I can convert any text in cell containing space to
"_"
For example, say I have a text "abc xyz" which should get converted in
"abc_xyz"


Regards,
Madiya

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Named range by VBA to another workbook


Sub FillInTheBlanks()
Dim str As String
str = "abc xyz"
str = Application.Substitute(str, " ", "_")
MsgBox str
End Sub
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



"Madiya"
wrote in message
Hi Jim,
Got the error.
The name is not valid (name should not contain any blank cherecter).
Is there any way I can convert any text in cell containing space to
"_"
For example, say I have a text "abc xyz" which should get converted in
"abc_xyz"
Regards,
Madiya



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 239
Default Named range by VBA to another workbook

On Aug 1, 5:24 am, "Jim Cone" wrote:
Sub FillInTheBlanks()
Dim str As String
str = "abc xyz"
str = Application.Substitute(str, " ", "_")
MsgBox str
End Sub
--
Jim Cone
San Francisco, USAhttp://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)

"Madiya"
wrote in message
Hi Jim,
Got the error.
The name is not valid (name should not contain any blank cherecter).
Is there any way I can convert any text in cell containing space to
"_"
For example, say I have a text "abc xyz" which should get converted in
"abc_xyz"
Regards,
Madiya


Thank you dear Jim.
My job is done with your help.

Regards,
Madiya

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Named Range From One Workbook Used in Validation Drop Down in 2nd Workbook Minitman Excel Discussion (Misc queries) 3 August 19th 08 05:30 PM
Workbook named range not seen by ADO when workbook closed Tim Lund[_2_] Excel Programming 2 March 16th 07 08:59 AM
Named Range in ANOTHER workbook frtklau Excel Discussion (Misc queries) 1 April 16th 05 12:21 AM
Named Range in ANOTHER workbook frtklau Excel Discussion (Misc queries) 0 April 15th 05 05:42 PM
Named Range in another workbook Jon C Excel Worksheet Functions 2 February 17th 05 01:07 PM


All times are GMT +1. The time now is 04:20 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"