ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Referencing a range from another workbook (https://www.excelbanter.com/excel-programming/273687-re-referencing-range-another-workbook.html)

Tom Ogilvy

Referencing a range from another workbook
 
Dim sPath as string, sName as String, sh as worksheet, bk as workbook
sPath = "C:\windows\temp\"
application.Screenupdating = False
sName = "savedfilename.xls"
set sh = activesheet
set bk = workbooks.open(sPath & sName)
Activesheet.cells.copy
sh.cells.PasteSpecial xlformats
bk.close savechanges:=false
Application.ScreenUpdating = True

--
Regards,
Tom Ogilvy


"Gary" wrote in message
...
I am saving a spreadsheet to the "TEMP" folder everytime a
user runs a "format" macro that I created. What I want to
do is when a user mistakenly formats the sheet They can
run a macro that will automatically restore
the "Formatted" sheet with the sheet that was saved into
the "TEMP" folder. Thanks for any input.

Gary





All times are GMT +1. The time now is 12:29 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com