开发者

Linking worksheets to a master worksheet and keeping values if the master worksheet is not present? Excel 2010

I have many worksheets and at present, every 3 months I have to go through these one by one to update information in just a few cells.

It would be great if I could create a master source file containing these few cells that get updated, that all my worksheets linked to, so that I could just update this file and all my files would then update.

The only trouble I have is that I then send these worksheets out to clients by email, each client gets a specific worksheet.

This would mean that the local links to开发者_如何学C the master source file would no longer be there and I'm assuming there would be errors. Is there some way that I could link my files, as desired, to a master file, be able to update the master file and have all the other files update accordingly, but then send only a single file to a client and keep the values from the master file.

I hope this is making sense! It's quite simple what I want to do, it's just a bit tricky putting it into words.

Any help or advice would be great!


You would think there would be a simple way to do this out of the box, but it does present a problem. This not very elegant solution shows how to copy cells or ranges from a master workbook that you must have open when you are updating your client sheets. Obviously the client user won't have the master workbook and so the macro fails silently in that case. Put this code in your ThisWorkbook module of each client workbook.

Private Sub Workbook_Open()
    On Error Resume Next
    Dim master As Workbook
    Set master = Workbooks("master.xlsm")

    If master Is Nothing Then
    'the client is probably opening the wbook. do nothing
    Else 'copy your stuff here
        With Workbooks("master.xlsm")
            .Worksheets("Sheet1").Range("A1:D4").Copy _
                Destination:=Worksheets("Sheet1").Range("A1:D4")
        End With
    End If

End Sub


I hope I understood your problem correctly. What we do is save the workbook as a different workbook with a different filename. We usually append "_sent.xlsx" to the workbook filename. Then open it, go to Data, Edit Links, and break all the links. Only the 'values' will remain in the work book. Save the workbook and you can send it out without having to worry about values that will break when they open it. And you still have your original file if you need to change anything.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜