ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   copy values between workbooks (https://www.excelbanter.com/excel-programming/289379-copy-values-between-workbooks.html)

Jonsson

copy values between workbooks
 
Hi,
I´m new to this programming thing!
I´m trying to copy values from one workbook to another. The workbooks are
identic to eachother exept for the values in some sheets and certain rows,
se below. All the other cells are containing formulas and are protected by
password.(It´s the formulas I sometimes need to change, so this will just be
a "upgrade" of the workbook. The thing is that the workbooks containing
aproximatly 150 sheets, and it´s only 50 of them thats really are concerned
by this need of copy the values. Can I loop them anyway?

My wish is to have a button in the new workbook, click that and you start a
macro that opens the "old" workbook(Sch20041H), and copy the values from the
old wbook, and paste them into the "new" one,
as I´ve describe.
I´ve tryed to do it by the code as below, but I get errors(naturally).

Thanks for your help!

//Thomas

Sub Sch2000copytonew()
'
' Sch2000copytonew Macro
' Macro recorded 1/28/2004 by Thomas
'

For Each ws In Worksheets
ws.Activate
Cells(Rows.Count, "B:D", "K:M", "T:V", "AC:AE", "AL:AN", "AU:AW",
"BD:BF").End(xlUp)(2).Select
Selection.Copy
Windows("Sch20041H.xls").Activate
For Each ws In Worksheets
ws.Activate
Cells(Rows.Count, "B:D", "K:M", "T:V", "AC:AE", "AL:AN", "AU:AW",
"BD:BF").End(xlUp)(2).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False
Sheets("Meny").Select
Range("B6").Select
End Sub




All times are GMT +1. The time now is 03:31 AM.

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