Thread: help excel
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Leith Ross[_264_] Leith Ross[_264_] is offline
external usenet poster
 
Posts: 1
Default help excel


Hello Ivica Lopar,

Susbstitute your workbook names and ranges in place of the ones in the
example. This example assumes 2 workbooks are open: Book1.xls and
Book2.xls. The macro copies the range A1:A5 from Book1.xls, Sheet1 to
Book2.xls, Sheet1 range B1:B5.


Code:
--------------------
Public Sub CopyRanges()

Sub CopyRange()

Dim dstRng As Excel.Range
Dim srcRng As Excel.Range

Set dstRng = Workbooks("Book2.xls").Worksheets("Sheet2").Range( "B1:B5")
Set srcRng = Workbooks("Book1.xls").Worksheets("Sheet1").Range( "A1:A5")

srcRng.Copy dstRng.Value

End Sub

--------------------

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=484597