+ Reply to Thread
Results 1 to 3 of 3

Dim Hyperlink

Hybrid View

  1. #1
    Registered User
    Join Date
    01-13-2016
    Location
    München
    MS-Off Ver
    2013
    Posts
    19

    Dim Hyperlink

    Hej,
    I like to copy some cells from a document I hyperlinked in my original document. The following code is working perfect:
    Sub Perfect ()
           With Range("A1:A3")
            .Formula "='hyperlinkedFile.xlsx'!A1"
            .Value = .Value
        End With
    End Sub
    But I want to replace the concrete name of the document by something like
    Dim File As String
    File = ActiveCell.Text (or so)
    to use it in
    .Formula "='File'!A1"
    But this is not working. Who knows the solution? :-)
    I'm really glad for help
    Regards
    Monica

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,653

    Re: Dim Hyperlink

    Try something like this...


    Sub Perfect()
        
        Dim File As String
        File = ActiveCell.Text
        
           With Range("A1:A3")
            .Formula "='" & File & "'!A1"
            .Value = .Value
        End With
    End Sub
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    01-13-2016
    Location
    München
    MS-Off Ver
    2013
    Posts
    19

    Re: Dim Hyperlink

    Perfect!!! Exactly the right solution :-)
    Thanks so much

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] With Hyperlink formula & vba, I want to copy text of hyperlink to the cell it's linked to
    By Freakytone in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-13-2017, 05:46 PM
  2. [SOLVED] Excel 2010 Create a macro to check if cell contains hyperlink then apply hyperlink style
    By chasidar in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-12-2013, 04:48 AM
  3. Using Vlookup to pull hyperlink from Master Hyperlink file list.
    By theflyingnimbus in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 04-02-2013, 01:42 PM
  4. Replies: 1
    Last Post: 02-23-2013, 05:18 AM
  5. Replies: 20
    Last Post: 03-19-2011, 09:13 AM
  6. Replies: 0
    Last Post: 03-26-2006, 07:10 PM
  7. Replies: 3
    Last Post: 05-06-2005, 01:06 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1