开发者

How to link many excel files to one master file, so that if I update the single master file, all linked files also update?

开发者 https://www.devze.com 2023-03-06 22:53 出处:网络
I\'m wondering if anybody can help? I have a large number of excel files. These are commission statements and some are converted from USD to UK Sterling, from UK sterling to Euros etc etc.

I'm wondering if anybody can help?

I have a large number of excel files. These are commission statements and some are converted from USD to UK Sterling, from UK sterling to Euros etc etc.

They are quarterly statemnets and at present I have to go through each file one by one and enter in the specific currency conversion rates for that month.

I was thinking it would be great if I could link all these statements to a single excel file which contained the conversion rates. I could then update this single currency conversion file and all the other files would update.

I think I could manage this, but there is a little problem I have ran into.

If I then send the statement files out to individuals, the local link between the two files would be lost and therefore, surly so would the conversion figures. The only fix I can see would be to send the file containing the conversion rates along with the statement, but if possible I would prefer not to do this.

I hope you can understand my problem and it would be great if anybody could suggest any fixes to this!

Thanks in advance :开发者_开发百科o)

I have had some advice here about including a hidden rates sheet in all excel files:

Linking cells from 2 different excel files, but then keeping figures if emailing only one file?

The rates within the visible sheets could then be linked to the cells in the hidden rates sheet and then the hidden rates sheet could be linked to a seperate single master rates file, which I would alter to update rates on all linked excel files.

I' still a bit unsure on how this would work if I was to send a single excel file to people in an email, because the local link to the master rates file would be lost. Is there a work arround?

Any help would be really really appreciated!


One approach is to put your master conversion rates workbook on the web

Your statement workbooks can the reference master workbook on the web via formulas. For example:

='http://www.your-site.com/test/[Workbook1.xls]Sheet1'!A1

Whilst this approach is fun, I would recommend using a master Excel conversion rates workbook on your network.


The statement workbooks would link to this master conversion rates workbook to get the rates.

Before sending the statements out, I would run some VBA code to loop through the workbooks.

The code would open the workbook, update the link and then break it.

The value that would be left in the linked cells is the latest updated value.

The code below updates and breaks all links in a workbook.

Sub Update_And_BreakLinks()

Dim vLinks As Variant
Dim lLinks As Long

    vLinks = ActiveWorkbook.LinkSources(Type:=xlLinkTypeExcelLinks)
'Get a list of all the links in the workbook

    If IsEmpty(vLinks) Then Exit Sub
'If no links then exit

    For lLink = LBound(vLinks) To UBound(vLinks)
        ActiveWorkbook.UpdateLink Name:=vLinks(lLink), Type:=xlLinkTypeExcelLinks
    Next lLink
'Update links

    For lLink = LBound(vLinks) To UBound(vLinks)
        ActiveWorkbook.BreakLink Name:=vLinks(lLink), Type:=xlLinkTypeExcelLinks
    Next lLink
'Break the links.  The link is replaced with the value from the last update

End Sub

Look at this question on how to loop through workbooks in a folder

5851531

0

精彩评论

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