Copy or replace sheet1 from a closed workbook
Hi Steve,
Try something like:
'=============
Private Sub Workbook_Open()
Dim WB As Workbook
Dim SH As Worksheet
Set WB = Workbooks("FirstBook.xls") '<<==== CHANGE
Set SH = WB.Sheets("Sheet1") '<<==== CHANGE
With Me.Sheets("Sheet1")
.Cells.Clear
SH.Cells.Copy Destination:=.Range("A1")
End With
End Sub
'<<=============
This code should be pasted into the ThisWorkbook module of the second
workbook.
Note that this code includes no error handling to allow, for example, that
the first workbook may not be open.
---
Regards,
Norman
"Steve" <No Spam wrote in message ...
I have a workbook that fires macros when opened so users only have access
to a form to add and amend data - this workbook holds data I need in the
workbook mentioned below.
When the second workbook opens, it shoud retrieve all data in Sheet1 in
the first workbook (or simply delete current Sheet1 and replace with a
copy). Does anyone have a simple method?
--
Steve
|