Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 162
Default Setting a .Range to equal another .Range

On Sheet1,

A1 = One

B1 = Two

What is the proper code to set ...

Sheet2.Range("A1:B1")

to be equal to Sheet1.Range("A1:B1") , so that on Sheet2

A1 = One

B1 = Two



- Ronald K.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 587
Default Setting a .Range to equal another .Range

hi Ronald,

Sheets("Feuil2").Range("A1:B1") = Sheets("Feuil1").Range("A1:B1").Value

--
isabelle

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 829
Default Setting a .Range to equal another .Range

"kittronald" wrote:
On Sheet1,
A1 = One
B1 = Two
What is the proper code to set ...
Sheet2.Range("A1:B1")
to be equal to Sheet1.Range("A1:B1") , so that on Sheet2
A1 = One
B1 = Two


Assuming that Sheet1 and Sheet2 are Worksheets variables that you set as
follows:

Set Sheet1 = Sheets("sheet1")
Set Sheet2 = Sheets("sheet2")

you would think the following would suffice since .Value is the default
member for Range variables:

Sheet2.Range("a1:b1") = Sheet1.Range("a1:b1")

But for reasons I cannot explain, statements of that form require .Value
written explicitly at least on the right-hand side, to wit:

Sheet2.Range("a1:b1") = Sheet1.Range("a1:b1").Value

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Setting a .Range to equal another .Range

On Oct 17, 4:51*pm, "kittronald" wrote:
* * On Sheet1,

* * * * A1 = One

* * * * B1 = Two

* * What is the proper code to set ...

* * * * Sheet2.Range("A1:B1")

* * to be equal to Sheet1.Range("A1:B1") , so that on Sheet2

* * * * A1 = One

* * * * B1 = Two

- Ronald K.


simply put in sheet 2

in cell a1 put
=sheet1!a1

in cell b1 put
=sheet1!b1
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 162
Default Setting a .Range to equal another .Range

Isabelle,

Drat !

Just missing the ".Value" at the end.

Merci beaucoup !



- Ronald K.




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 162
Default Setting a .Range to equal another .Range

I was thinking the same thing and left off ".Value".

Adding ".Value" fixed the problem.

Thanks for the quick response.



- Ronald K.


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
SUMPRODUCT or SUMIF if any values in a range equal any values in another range PCLIVE Excel Worksheet Functions 3 July 15th 09 07:43 PM
Setting a range.value equal to /part/ of a (3D) variant array? ker_01 Excel Programming 3 July 21st 08 07:23 PM
Excel Addin:Setting the range to the Excel.Range object range prop Rp007 Excel Worksheet Functions 5 November 24th 06 04:30 PM
setting range().hidden=True causes range error 1004 STEVE BELL Excel Programming 6 September 2nd 05 02:16 AM
setting a range variable equal to the value of a string variable Pilgrim Excel Programming 2 July 1st 04 11:32 PM


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