Linking to user specified file
Sub CreateLink()
Dim rng as Range, bk as Workbook
Dim fName as Variant
set rng = activecell.parent.Range("A1")
fname = application.GetOpenFileName()
if fName = False then exit sub
set bk = workbooks.open(fName)
bk.Worksheets(1).Range("A1").Formula = "=" & _
rng.Address(1,1,xlA1,True)
bk.Close Savechanges:=True
End Sub
--
Regards,
Tom Ogilvy
" wrote:
I want to link cell A1 in workbook1 to more than one workbook. I
actually want a procedure to ask the user to specify which workbook to
link to. How can I do this? Can I automate this so that the user
specifies the file and updates cells ?
|