Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Setting Range Name using R1C1

I am trying to set a range name using the R1C1 format. Here is what I have
tried

Dim MyRangeName as Range
Set MyRangeName = Workbooks("Workbook1").Sheets("Sheet1").Range(Cell s(12,
12), Cells(15, 12))

The above line produces the following error: "Application-defined or
Object-defined error".

What I find strange is the above macro works fine if I replace the above with:
Set MyRangeName = Workbooks("Workbook1").Sheets("Sheet1").Range("L12 :L15")

For reasons that I believe are not relevant, I need to use the R1C1 method.

Any suggestions would be much appreciated.

--
needVBAhelp
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Setting Range Name using R1C1

The code doesn't know which worksheet CELLS is locat on. Use this instead

with Workbooks("Workbook1").Sheets("Sheet1")
Set MyRangeName = .Range(.Cells(12, 12), .Cells(15, 12))
end with

Notice the dot I put in front of CELLS


"needVBAhelp" wrote:

I am trying to set a range name using the R1C1 format. Here is what I have
tried

Dim MyRangeName as Range
Set MyRangeName = Workbooks("Workbook1").Sheets("Sheet1").Range(Cell s(12,
12), Cells(15, 12))

The above line produces the following error: "Application-defined or
Object-defined error".

What I find strange is the above macro works fine if I replace the above with:
Set MyRangeName = Workbooks("Workbook1").Sheets("Sheet1").Range("L12 :L15")

For reasons that I believe are not relevant, I need to use the R1C1 method.

Any suggestions would be much appreciated.

--
needVBAhelp

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Setting Range Name using R1C1

Joel,

Worked great!! Thanks so much!!!

--
needVBAhelp


"Joel" wrote:

The code doesn't know which worksheet CELLS is locat on. Use this instead

with Workbooks("Workbook1").Sheets("Sheet1")
Set MyRangeName = .Range(.Cells(12, 12), .Cells(15, 12))
end with

Notice the dot I put in front of CELLS


"needVBAhelp" wrote:

I am trying to set a range name using the R1C1 format. Here is what I have
tried

Dim MyRangeName as Range
Set MyRangeName = Workbooks("Workbook1").Sheets("Sheet1").Range(Cell s(12,
12), Cells(15, 12))

The above line produces the following error: "Application-defined or
Object-defined error".

What I find strange is the above macro works fine if I replace the above with:
Set MyRangeName = Workbooks("Workbook1").Sheets("Sheet1").Range("L12 :L15")

For reasons that I believe are not relevant, I need to use the R1C1 method.

Any suggestions would be much appreciated.

--
needVBAhelp

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
R1C1 - how can I permanently undo this setting in Excel? Sheila Setting up and Configuration of Excel 7 August 15th 08 07:11 PM
Discontinuous Range via VBA using R1C1? (PeteCresswell) Excel Programming 7 December 2nd 06 01:12 AM
Using R1C1 in VB to select a range Robert_L_Ross Excel Programming 2 December 17th 05 07:45 AM
Select Range using R1C1 verizon Excel Programming 4 June 16th 04 01:11 PM
R1C1 to Range Jahson Excel Programming 3 February 17th 04 12:29 PM


All times are GMT +1. The time now is 12:15 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"