Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Linking to user specified file

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 ?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default 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 ?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Linking to user specified file

Could you tell me what exactly this code is doing ? I am not sure if I
am getting the desired result..


On Feb 7, 11:27 am, Tom Ogilvy
wrote:
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 ?- Hide quoted text -


- Show quoted text -



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Linking to user specified file

it creates a link from the workbook selected by the user back to A1 of the
activesheet when you run the macro. the link is established in cell A1 of
the first sheet in the workbook specified.

I want to link cell A1 in workbook1 to more than one workbook.


so your Workbook1 should be the activeworkbook when you run the macro.

--
Regards,
Tom Ogilvy



" wrote:

Could you tell me what exactly this code is doing ? I am not sure if I
am getting the desired result..


On Feb 7, 11:27 am, Tom Ogilvy
wrote:
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 ?- Hide quoted text -


- Show quoted text -




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Linking to file, some formulas work only if file is open ST Matt Links and Linking in Excel 0 February 17th 11 07:22 PM
Linking to another file using file reference typed cell Steven Excel Worksheet Functions 3 April 5th 08 03:15 AM
linking multiple roles (rows) to a user (cell) Yoesrie Excel Discussion (Misc queries) 0 April 4th 07 09:38 AM
Linking multiple scripts by user OK Cyntalan Excel Programming 1 October 20th 06 04:01 AM
Turning a text file name into a search and linking the file as a hyperlink AlistairM Excel Discussion (Misc queries) 1 January 26th 06 04:55 AM


All times are GMT +1. The time now is 05:44 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"