Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 125
Default Reference Range Names in Macro

Hi, This works:

Sheets("Notes").Range("b17:K17").Copy Sheets("RouteSlip").Range("B39:K39")

But I was hoping to use range names instead of cell references and I can't
make it work.

Range b17:K17 = Audit1
Range b39:k39 = Note1

Thank you.

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 125
Default Reference Range Names in Macro

I should add that the B17:K17 and b39:k39 are merged cells. Not sure if that
matters.

"Karin" wrote:

Hi, This works:

Sheets("Notes").Range("b17:K17").Copy Sheets("RouteSlip").Range("B39:K39")

But I was hoping to use range names instead of cell references and I can't
make it work.

Range b17:K17 = Audit1
Range b39:k39 = Note1

Thank you.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,939
Default Reference Range Names in Macro

Assuming your named ranges are globally defined then

application.names("Audit1").referstorange.copy _
Destination:=application.names("Note1").referstora nge
--
HTH...

Jim Thomlinson


"Karin" wrote:

Hi, This works:

Sheets("Notes").Range("b17:K17").Copy Sheets("RouteSlip").Range("B39:K39")

But I was hoping to use range names instead of cell references and I can't
make it work.

Range b17:K17 = Audit1
Range b39:k39 = Note1

Thank you.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 125
Default Reference Range Names in Macro

Hi, Jim, thank you.
It didn't work, perhaps I'm not globally defined - ranges were named in the
name box, sheet that Audit1 is on is hidden.

"Jim Thomlinson" wrote:

Assuming your named ranges are globally defined then

application.names("Audit1").referstorange.copy _
Destination:=application.names("Note1").referstora nge
--
HTH...

Jim Thomlinson


"Karin" wrote:

Hi, This works:

Sheets("Notes").Range("b17:K17").Copy Sheets("RouteSlip").Range("B39:K39")

But I was hoping to use range names instead of cell references and I can't
make it work.

Range b17:K17 = Audit1
Range b39:k39 = Note1

Thank you.

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,939
Default Reference Range Names in Macro

If they are locally declared then...

Sheets("Notes").Range("Audit1").Copy Sheets("RouteSlip").Range("Note1")
--
HTH...

Jim Thomlinson


"Karin" wrote:

Hi, Jim, thank you.
It didn't work, perhaps I'm not globally defined - ranges were named in the
name box, sheet that Audit1 is on is hidden.

"Jim Thomlinson" wrote:

Assuming your named ranges are globally defined then

application.names("Audit1").referstorange.copy _
Destination:=application.names("Note1").referstora nge
--
HTH...

Jim Thomlinson


"Karin" wrote:

Hi, This works:

Sheets("Notes").Range("b17:K17").Copy Sheets("RouteSlip").Range("B39:K39")

But I was hoping to use range names instead of cell references and I can't
make it work.

Range b17:K17 = Audit1
Range b39:k39 = Note1

Thank you.



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Reference Range Names in Macro

Merged cells are a pain...

Can you just assign the value?

WorkSheets("RouteSlip").Range("Note1").Value _
= WorkSheets("Notes").Range("Audit1")



Karin wrote:

Hi, This works:

Sheets("Notes").Range("b17:K17").Copy Sheets("RouteSlip").Range("B39:K39")

But I was hoping to use range names instead of cell references and I can't
make it work.

Range b17:K17 = Audit1
Range b39:k39 = Note1

Thank you.


--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Reference Range Names in Macro

The named ranges are defined currently?

Audit1 refers to =Notes!$B$17:$K$17

Notel refers to =RouteSlip!$B$39:$K$39

No need to paste to a range.

Top left cell only will do.

Sheets("Notes").Range("Audit1").Copy Sheets("RouteSlip").Range("B39")

But you can use "Notel" if you want to.


Gord Dibben MS Excel MVP

On Wed, 26 Aug 2009 12:30:03 -0700, Karin
wrote:

Hi, This works:

Sheets("Notes").Range("b17:K17").Copy Sheets("RouteSlip").Range("B39:K39")

But I was hoping to use range names instead of cell references and I can't
make it work.

Range b17:K17 = Audit1
Range b39:k39 = Note1

Thank you.


  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 125
Default Reference Range Names in Macro

Thank you, but for some reason it doesn't work. However, the answer below
from Dave Peterson does work.

"Jim Thomlinson" wrote:

If they are locally declared then...

Sheets("Notes").Range("Audit1").Copy Sheets("RouteSlip").Range("Note1")
--
HTH...

Jim Thomlinson


"Karin" wrote:

Hi, Jim, thank you.
It didn't work, perhaps I'm not globally defined - ranges were named in the
name box, sheet that Audit1 is on is hidden.

"Jim Thomlinson" wrote:

Assuming your named ranges are globally defined then

application.names("Audit1").referstorange.copy _
Destination:=application.names("Note1").referstora nge
--
HTH...

Jim Thomlinson


"Karin" wrote:

Hi, This works:

Sheets("Notes").Range("b17:K17").Copy Sheets("RouteSlip").Range("B39:K39")

But I was hoping to use range names instead of cell references and I can't
make it work.

Range b17:K17 = Audit1
Range b39:k39 = Note1

Thank you.

  #9   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 125
Default Reference Range Names in Macro

Thank you -works great.


"Dave Peterson" wrote:

Merged cells are a pain...

Can you just assign the value?

WorkSheets("RouteSlip").Range("Note1").Value _
= WorkSheets("Notes").Range("Audit1")



Karin wrote:

Hi, This works:

Sheets("Notes").Range("b17:K17").Copy Sheets("RouteSlip").Range("B39:K39")

But I was hoping to use range names instead of cell references and I can't
make it work.

Range b17:K17 = Audit1
Range b39:k39 = Note1

Thank you.


--

Dave Peterson

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
Getting values from names by reference Charlie Smith Excel Discussion (Misc queries) 5 July 17th 09 11:04 PM
COPYING FORMULA CONTAINING NAMES/RELATIVE RANGE NAMES Bricol Excel Discussion (Misc queries) 0 July 8th 08 03:54 PM
automatic range - named range give me circular reference... George Thorogood Excel Discussion (Misc queries) 0 February 22nd 07 07:53 PM
reference to range names duane Excel Discussion (Misc queries) 3 August 2nd 06 10:15 PM
Selecting range in list of range names depending on a cell informa Courreges Excel Discussion (Misc queries) 2 June 19th 06 10:59 AM


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