+ Reply to Thread
Results 1 to 3 of 3

Pass range as variable to Range function

  1. #1
    Registered User
    Join Date
    11-16-2011
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    20

    Smile Pass range as variable to Range function

    Hi,

    I have to write a VBA to copy a hyperlink to a destination cell.

    Hyperlinks are in Column A from A1:A5 say

    My macro should copy the cell A1 to say destination cell E7.

    Now for that please find the code below:

    Please Login or Register  to view this content.
    This code throws error as it is not able to process Range(myRange) and if I change that to Range("A1") this works fine.

    But I need to dynamically select the cells as the hyperlink can be in any cell of A column so it should be the cell that I click on.

    Secondly I need this macro to link with On Click event of that cell. How do I do that?

    Please help.

    Kind Regards
    Paul
    Last edited by souvick; 11-17-2011 at 08:28 AM.

  2. #2
    Registered User
    Join Date
    11-16-2011
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: Pass range as variable to Range function

    Hi,

    This has been solved but by another method.

    Please find the code below

    Please Login or Register  to view this content.

  3. #3
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,008

    Re: Pass range as variable to Range function

    FWIW, in your original code, this:
    Please Login or Register  to view this content.
    should have been:
    Please Login or Register  to view this content.
    Everyone who confuses correlation and causation ends up dead.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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