Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 88
Default Copying Cell Using Macro

I'd like to create a macro that copies the cell range from one workbook to another

I have two workbooks, namely Book1 and Book2, When I open Book2, It must copy the cell range e.g A1:B10
from Book1 and place them in the same range.


try this in ThisWorkbook from Book2:

Private Sub Workbook_Open()
Dim wbk As Workbook

' examine whether Book1 is open
On Error Resume Next
Set wbk = Workbooks("Book1")
If Err Then Exit Sub

Me.Worksheets("Sheet1").Range("A1:B10").Value = _
wbk.Worksheets("Sheet1").Range("A1:B10").Value
End Sub

--
Regards

Melanie Breden
- Microsoft MVP für Excel -

http://excel.codebooks.de (Das Excel-VBA Codebook)

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
Macro for copying ? DaveAsh Excel Discussion (Misc queries) 0 December 17th 09 12:32 PM
copying using a macro divad Excel Worksheet Functions 3 June 27th 08 09:49 PM
Macro for Copying Frank Situmorang[_2_] Excel Worksheet Functions 9 January 29th 08 08:04 AM
creating macro for copying the value from one cell ananthu New Users to Excel 1 February 2nd 07 01:20 PM
Copying a cell to another cell using a macro Olly[_3_] Excel Programming 1 November 20th 03 03:09 PM


All times are GMT +1. The time now is 08:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"