+ Reply to Thread
Results 1 to 5 of 5

Making this simple macro 'relative'.

  1. #1
    Forum Contributor terrypin's Avatar
    Join Date
    01-06-2010
    Location
    East Grinstead, UK
    MS-Off Ver
    MS Office 365
    Posts
    533

    Making this simple macro 'relative'.

    In my screenshot, row 23 contains abbreviated names for hyperlinks that I want to create in row 24. That set of cells (B24:J24) initially contains the text of full filenames, with path.

    MakeMacroRelative-1.jpg

    To save considerable manual effort (there are many sheets like this) I'm trying to write a macro which will convert that text to a hyperlink, and replace the original text with my abbreviated names from B23:J23.

    I've recorded the following:

    Please Login or Register  to view this content.
    At present, of course, wherever I apply it, it just duplicates the specific col B result. I'm struggling with how to edit that to make it 'relative' - something I always have difficulty with.

    So any help would be much appreciated please.
    Terry, East Grinstead, UK
    Excel 365, Win 10 Pro, i7 PC, 4.0 GHz

  2. #2
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,057

    Re: Making this simple macro 'relative'.

    Hi Terry,

    See if this works for you?

    Please Login or Register  to view this content.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  3. #3
    Forum Contributor terrypin's Avatar
    Join Date
    01-06-2010
    Location
    East Grinstead, UK
    MS-Off Ver
    MS Office 365
    Posts
    533

    Re: Making this simple macro 'relative'.

    Many thanks Arkadi, that works just fine! Grateful for such a fast response.

    Just one problem. As a VBA novice it took me a while to realise it would not work in the first place I inserted it, in Personal.xlsb. I've had to place it in this specific worksheet. Can you please advise how I can make it more general, working either from any workbook, or from one specific workbook called Walk Index.xlsm that will always be open when I want to work on Track Data.

  4. #4
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,057

    Re: Making this simple macro 'relative'.

    Hmm... my macro would run just fine from a standard module... it does not need to be in a specific worksheet. However, if you want to generalise it, say to run from where it is stored, but affect the active workbook and sheet, you can change it to:
    (I also forgot to change "ActiveSheet" to "ws" in my code...)


    Please Login or Register  to view this content.
    p.s. Thanks for the rep

  5. #5
    Forum Contributor terrypin's Avatar
    Join Date
    01-06-2010
    Location
    East Grinstead, UK
    MS-Off Ver
    MS Office 365
    Posts
    533

    Re: Making this simple macro 'relative'.

    Thanks Arkadi, I'll try that first thing tomorrow.

    EDIT: Briliant, now works exactly as I wanted, thank you!
    Last edited by terrypin; 01-05-2018 at 05:17 AM.

+ 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] Making a Number Relative
    By HangMan in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-02-2015, 05:34 AM
  2. Simple Macro that updates cell after making a selection in a drop down list?
    By Vikestand in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-01-2013, 04:37 PM
  3. I need help with making a macro relative to a selection field within the macro
    By namer98 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-30-2013, 11:30 AM
  4. Making Rows Relative in VBA
    By HangMan in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-15-2013, 02:36 PM
  5. [SOLVED] Making Simple Recorded Macro Generally Applicable
    By One-Eyed Enos in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-06-2012, 11:16 AM
  6. making cells change relative to each other?
    By MMA in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 06-13-2006, 12:25 AM
  7. [SOLVED] Making the Sheet a relative value?
    By AuMiQuinn in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-05-2005, 04:06 PM

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