#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default help excel

how can I copy specific range of cells from one workbook to another


  #2   Report Post  
Posted to microsoft.public.excel.programming
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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default help excel

Dim sh1 as Worksheet, sh2 as Worksheet
set sh1 = Workbooks("Book1.xls").WorkSheets("Sheet1")
set sh2 = Workbooks("Book2.xls").Worksheets("Sheet3"

sh1.Range("a1:B10").copy Destination:=sh2.Range("F9")

--
Regards,
Tom Ogilvy

"Ivica Lopar" wrote in message
...
how can I copy specific range of cells from one workbook to another




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



All times are GMT +1. The time now is 07:45 AM.

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"