Ok so I am new here and was browsing the forums. I can usually always find what I need, but I have been messing with this for several hours and its driving me crazy.
What I want to do is have a button that when clicked will take you to a random page (hyperlink) inside the workbook.
This is where I am. I made a list of links I wanted to yield by clicking on the button. I used a random number generator to generate a number. Using this number I created an if statement to yield the randomized page as a link in a specified cell. I created a macro to allow the link to be clicked and added it to the button. I thought this would work the way I wanted, but I was wrong. Here is my problem the macro will not pick up on the link that is generated by the if statement. (not saying it won't I don't know how) I tried to fix this by not using if statement and putting a link in the cell and recording the macro. I got the button to work with a link and I got the if statement to yield what I want but I can not combine the two to make it work properly.I am certain I am overlooking something very simple that is why I am asking for help.
Also if there is another way to just add multiple hyperlinks (randomized) to one button that I do not know about that would be great as well. Thanks in advance for any help that can be offered.
Last edited by Sman1985; 05-08-2011 at 09:43 AM. Reason: Added a dummy workbook just so you could get an idea of what I am doing.
Maybe some code like this?
Sub RandomHyperlink() ActiveSheet.Hyperlinks(WorksheetFunction.RandBetween(1, ActiveSheet.Hyperlinks.Count)).Follow End Sub
Martin
Eighty Twenty Spreadsheet Automation http://homepage.ntlworld.com/martin.rice1/ for all your Excel customisation and consulting needs.
If my solution has saved you time and/or money, please consider donating to Cancer Research UK.
Sweet that was exactly what I was looking for. Is there a way to set it to only random between certain hyperlinks in certain cells so if I put more than one hyperlink it will only use the ones selected?
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks