VBA search page hyperlinks from data validation list

CalRich1023

New Member
Joined
Mar 15, 2021
Messages
48
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Hello,

I've a "search" page that loops through all the sheets to return data to my search page and produce a hyperlink to each sheet said data is found. One of the search criteria is from a data validation list. I believe this is messing up the ordered list of search results. I have the code below that works perfect for the first item in the data validation list, but as soon as i search for something that is lower on the data validation list, my results get all jumbled and it messed everything up. Could someone please help correct my error in this code?

Worksheets("SEARCH").Hyperlinks.Add Anchor:=Cells(i + 1, "A"), Address:="", SubAddress:=Worksheets(i).Name, TextToDisplay:=Worksheets(i).Name
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Update:
It works fine with this code, not producing hyperlinks. I think i'm just not familiar enough with hyperlinks to make this work properly.

Worksheets("SEARCH").Cells(lastrow + 1, 1).Value = Worksheets(i).Name
 
Upvote 0
Hello,

I've a "search" page that loops through all the sheets to return data to my search page and produce a hyperlink to each sheet said data is found. One of the search criteria is from a data validation list. I believe this is messing up the ordered list of search results. I have the code below that works perfect for the first item in the data validation list, but as soon as i search for something that is lower on the data validation list, my results get all jumbled and it messed everything up. Could someone please help correct my error in this code?

Worksheets("SEARCH").Hyperlinks.Add Anchor:=Cells(i + 1, "A"), Address:="", SubAddress:=Worksheets(i).Name, TextToDisplay:=Worksheets(i).Name
Update:
It works fine with this code, not producing hyperlinks. I think i'm just not familiar enough with hyperlinks to make this work properly.

Worksheets("SEARCH").Cells(lastrow + 1, 1).Value = Worksheets(i).Name
Update 2:
Sometimes i feel silly. I got this fixed with the following change:
Worksheets("SEARCH").Hyperlinks.Add Anchor:=Cells(lastrow + 1, "A"), Address:="", SubAddress:=Worksheets(i).Name, TextToDisplay:=Worksheets(i).Name

Thanks anyway!
 
Upvote 0
Solution

Forum statistics

Threads
1,223,958
Messages
6,175,636
Members
452,662
Latest member
Aman1997

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top