View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Copying multiple sheets to another workbook

This would change from:

origwkbk.worksheets("origin sheet a").range("b3:c198").copy _
destination:=newwkbk.worksheets("dest sheet A").range("b3")

to:

origwkbk.worksheets("origin sheet a").range("b3:c198").copy
newwkbk.worksheets("dest sheet A").range("b3").pastespecial paste:=xlpastevalues

Or you could just assign the values, too:

dim rngtocopy as range
dim destcell as range

set rngtocopy = origwkbk.worksheets("origin sheet a").range("b3:c198")
set destcell = newwkbk.worksheets("dest sheet A").range("b3")

destcell.resize(rngtocopy.rows.count,rngtocopy.col umns.count).value _
= rngtocopy.value

Using the range variables makes that last statement easier to type and makes the
whole thing easier to change.


mwc0914 wrote:

Dave,

What if I'm copying cells that contain a formula & I want to do a paste
special of values only in the destination. What would my stement look
like then?

Thanks

--
mwc0914
------------------------------------------------------------------------
mwc0914's Profile: http://www.excelforum.com/member.php...o&userid=24130
View this thread: http://www.excelforum.com/showthread...hreadid=487404


--

Dave Peterson