ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help needed... please (Copy Past Macro) (https://www.excelbanter.com/excel-programming/399640-help-needed-please-copy-past-macro.html)

mydogpeanut

Help needed... please (Copy Past Macro)
 
Hello,

I am trying to create a macro based on information provided to me by JR Form
(thank you very much by the way). I would like the Macro to copy 9 tabs from
an existing workbook into a new workbook and then break all the links in the
new work book from the old one. This is what I have so far and I can't seem
to get it to work can any one help me? Thanks a ton :)

Sub CopyTheSheets()

Dim DestWB As Workbook
Dim ws As Worksheet
Dim Wrkbk As String
LinkPath = ActiveWorkbook.FullName
Mastr = ActiveWorkbook.Name
'Wrkbk = Sheets("Instructions").Range("A41")
Set DestWB = Workbooks(Wrkbk)

For Each ws In ThisWorkbook.Worksheets
With DestWB.Worksheets
ws.Copy after:=.Item(.Count)


Linkage (LinkPath)
ActiveWorkbook.Save
Windows(Mastr).Activate
End With
End Sub

Function Linkage(link1 As String)
ActiveWorkbook.ChangeLink link1, ActiveWorkbook.FullName, xlExcelLinks
End Function


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

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