View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
mike allen[_2_] mike allen[_2_] is offline
external usenet poster
 
Posts: 85
Default copy paste special values

alright. i guess i got it. it looks like to be consistent, i need to use:
Range(Sheets("sheet1").Cells(1, 1), Sheets("sheet1").Cells(3, 3))=
Range(Sheets("sheet2").Cells(1, 1), Sheets("sheet2").Cells(3, 3)).Value
where this IS a mirror image, i just had the syntax wrong on both sides
originally. thx

"mike allen" wrote in message
...
i need to clarify. the top code in original message does NOT work, while
the bottom code does work. i have found a way to get the top to work, but
not sure why it works. i did the following to get the one line code to
work:
Sheets("sheet1").Range(Cells(1, 1), Cells(3, 3)) =
Range(Sheets("sheet2").Cells(1, 1), Sheets("sheet2").Cells(3, 3)).Value

while the following does not work:
Sheets("sheet1").Range(Cells(1, 1), Cells(3, 3)) =
Sheets("sheet2").Range(Cells(1, 1), Cells(3, 3)).Value

why would this work and not the mirror image of the destination range? thx

"mike allen" wrote in message
...
I need to copy a range to another area. I am trying:

Sheets("sheet1").Range(Cells(1, 1), Cells(3, 3)) =
Sheets("sheet2").Range(Cells(1, 1), Cells(3, 3)).Value

I can get it this way, but seems like too much code and slower. I have
come accustomed to using the above 1 liner, but this example, for some
reason, doesn't work.

Sheets("sheet2").Range(Cells(1, 1), Cells(3, 3)).Copy
Sheets("sheet1").Cells(1, 1).PasteSpecial Paste:=xlValues
Application.CutCopyMode = False

any thoughts? thanks, mike allen