MrExcel Message Board

Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old Mar 19th, 2002, 12:00 PM   #1
Brian from Maui
Board Regular
 
Brian from Maui's Avatar
 
Join Date: Feb 2002
Posts: 7,743
Default

Aloha,

I renamed my worksheets in a workbook not realizing that it breaks the hyperlinks. I tried using "replace" but that does not seem to work. I can't rename the the sheets, as I have other formulas with the new worksheet names. Anyone have any ideas, besides doing it one by one?

Brian
Brian from Maui is offline   Reply With Quote
Old Mar 19th, 2002, 03:11 PM   #2
Duane
Board Regular
 
Join Date: Mar 2002
Location: Toronto
Posts: 173
Default

Quote:
On 2002-03-19 11:00, Brian from Maui wrote:
Aloha,

I renamed my worksheets in a workbook not realizing that it breaks the hyperlinks. I tried using "replace" but that does not seem to work. I can't rename the the sheets, as I have other formulas with the new worksheet names. Anyone have any ideas, besides doing it one by one?

Brian
Are your hyperlinks to other pages within the workbook? As far as I know, any formulas that have sheet tab names in them will automatically update when you change a sheet tab name.

If your hyperlink is to another named range in your workbook, then changing the sheet name again will automatically update the reference to the named range.

Regards, Duane
__________________
Regards, Duane
h. Office2003 in WinXP
o. Office2007 in Win7
Duane is offline   Reply With Quote
Old Mar 19th, 2002, 03:39 PM   #3
Jack in the UK
Board Regular
 
Join Date: Feb 2002
Posts: 3,065
Default

Hi Mate

Ermm you changed only the sheet name or WrkBk name?? Should auto amend, or haver i lost the plot/// Idea

Chjhange the name back, if can reememebr te file name file open lists the docd or windows recent or start docs will give them away so full name ther.

No back up eh! now now, you read all my posts i know and how often do i scream BACK UP BACK UP BACK UP! so you could play and carry on on original without agro until FULLY solved.

Also set up another sheet TEST DUMY links oe somethings and play till you get it right, i never work live (thats on the critical current sheet UNLESS its fullt tested)

Also ... no its should be all oK...


__________________
Free Excel based Web Toolbar available here.

Jack in the UK
J & R Excel Solutions
"making Excel work for you"
Jack in the UK is offline   Reply With Quote
Old Mar 19th, 2002, 03:45 PM   #4
NateO
Legend
 
NateO's Avatar
 
Join Date: Feb 2002
Location: Minneapolis, Mn, USA
Posts: 9,704
Default

Well Brian, I feel your pain, my links don't seem to update when I change a sheet name. But here's some vba to generate links, not sure if it helps.

Sub Workshts()
Dim ws As Worksheet, wsTOC As Worksheet
Dim r As Integer, c As Integer
Application.ScreenUpdating = False
Set wsTOC = ActiveSheet
r = ActiveCell.Row
c = ActiveCell.column
For Each ws In ActiveWorkbook.Worksheets
wsTOC.Hyperlinks.Add _
Anchor:=wsTOC.Cells(r, c), _
Address:="", _
SubAddress:=ws.Name & "!A1", _
TextToDisplay:=ws.Name
r = r + 1
Next
Application.ScreenUpdating = True
End Sub
__________________
Regards,
Nate Oliver
Microsoft Excel MVP
Nate's Excel Blog
NateO is offline   Reply With Quote
Old Mar 19th, 2002, 03:46 PM   #5
Brian from Maui
Board Regular
 
Brian from Maui's Avatar
 
Join Date: Feb 2002
Posts: 7,743
Default

Duane,

Couldn't see the tree through the forrest again!

Brian
Brian from Maui is offline   Reply With Quote
Old Mar 19th, 2002, 09:05 PM   #6
Reggie
New Member
 
Join Date: Mar 2002
Posts: 10
Default

As a bit of an add-on to the previous question, I was wondering whether someone could help me adjust the code provided by NateO so that it creates the hyperlinks based on names created in another sheet.

Assmume sheet2 has defined names ranging from Answer1 to Answer100, I want on sheet1 to automatically hyperlink to these names. The cells in Sheet1 will have Answer1 to Answer100 typed in them. Just a bit tedious manually placing them all in.

I tried playing around with it a little, but my low level of VB knowledge makes it a long road.

Any help would be greatly appreciated. Thankyou.
Reggie is offline   Reply With Quote
Old Mar 19th, 2002, 10:16 PM   #7
Brian from Maui
Board Regular
 
Brian from Maui's Avatar
 
Join Date: Feb 2002
Posts: 7,743
Default

Aloha,

Just curious, can you edit the hyperlinks with something like "replace", or is it one by one?

Brian
Brian from Maui is offline   Reply With Quote
Old Mar 19th, 2002, 10:28 PM   #8
Reggie
New Member
 
Join Date: Mar 2002
Posts: 10
Default

Not sure whether replace can be used here.

Say I have the following on sheet1:


A
Answer1
Answer2
Answer3
Answer4
.......
Answer100

Each of these contains a hyperlink which refers to the same name in sheet2.

Not sure how I would do this using replace, but you maybe on to something. Thanks for that anyway mate.
Reggie is offline   Reply With Quote
Old Mar 19th, 2002, 10:48 PM   #9
Brian from Maui
Board Regular
 
Brian from Maui's Avatar
 
Join Date: Feb 2002
Posts: 7,743
Default

I've tried to use replace but that doesn't seem to work, or am I missing something again. Like Duane said I can always change the sheet names back to what the hyperlinks had but I was just curious if it could be done without doing each hyperlink one by one or by changing the sheet name to the original
Brian from Maui is offline   Reply With Quote
Old Mar 20th, 2002, 03:39 AM   #10
Tommy Bak
Board Regular
 
Join Date: Feb 2002
Location: Guderup, Denmark
Posts: 287
Default

This macro will change the destinationaddress from the old sheetnames to the new ones.
Just write the old sheetnames in column E and beside them in column F the new name of the sheet.
Adjust the range in the macro according to your needs.

Sub ChangeHyperlinks()
Dim newones As Variant
newones = Sheets(1).Range("e1:f3")
Dim rSH As Worksheet
For Each rSH In ActiveWorkbook.Worksheets
For Each h In Worksheets(rSH.Name).Hyperlinks
g = h.SubAddress
For x = 1 To UBound(newones)
If InStr(1, g, newones(x, 1)) Then h.SubAddress = Replace(g, newones(x, 1), newones(x, 2))
Next
Next
Next
End Sub


regards Tommy
Tommy Bak is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 02:33 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
All contents Copyright 1998-2012 by MrExcel Consulting.
diabetic desserts recipes recipes Diabetic Soups Holiday Pizza Recipes Popcorn Recipes Recipes For Microwave Pasta Recipes Casserole Recipes Chili Recipes Curry Recipes Crockpot Recipes Apples Recipes Bread Recipes Vegetarian Recipes Vegetable recipes Desserts Recipes Appetizers Ethnic Recipes Meat Dishes Barbecue Recipes Sauces Recipes Marinade Recipes Low Fat Recipes Frugal Gourmet Kitchen Classics Recipes On The Grill Cook Books Seafood Recipes Cajun Recipes Breads Low Fat Low Fat Breads Bread Machine Recipes Yeast Breads Quick Breads Fat Free Vegetarian Salad Recipes Eggplant Recipes Radish Recipes Tomato Recipes Jalapeno Recipes Potato Recipes Lettuce Recipes Cabbage Recipes Beans Ambrosia Recipes Biscotti Recipes Desserts Low Fat Cookie Recipes Cheesecake Recipes Cake Recipes Pie Recipes Muffin Recipes Custard Recipes Best Appetizers Appetizers Low Fat Salsa Recipes Dip Recipes International Recipes Afghan Recipes Alaska Recipes French Recipes German Recipes Greek Recipes Italian Recipes Spanish Recipes Thai Recipes Korean Recipes Chinese Recipes Mexican Recipes Indian Recipes Beef Recipes Pork Pork & Ham Pork Butts Pork Chop Recipes Pork Ribs Rulled Pork Poultry Recipes Stews Recipes Ground Beef Barbecue Grill Barbecue Smoker All Purpose Sauce BBQ Sauce Barbecue Sauce Carolina BBQ Sauce Pickle Recipes Marinades Smoking Low Fat Appetizers & Dips Low Fat Breakfast Low Fat Cakes Low Fat Cheesecakes Low Fat Cookies Low Fat Desserts Low Fat Fish & Seafood Low Fat Meats Low Fat Pasta Low Fat Pies Low Fat Salads Low Fat Sandwiches Low Fat Sauces & Condiments Low Fat Sides Low Fat Soups Low Fat Vegetarian Baker's Dozen Taste of Home Recipe Book Bon Appetit Cookbook Blacktie Cookbook Buster Cook Book Cookbook USA Cook Book Cook Book Sara's Cookbook Sara's Cookbook Appetizers and Dips Poultry recipes Diabetic recipes Holiday recipes Miscellaneous recipes 110 recipes 1986 Usenet cookbook 2900 recipes Cyberrealm recipes Great sysops of world Specialty recipes Ceideburg recipes Cheese recipes Chili recipes Fruits recipes Garlic recipes Great chefs of NY Londontowne recipes Raisins recipes Recipes for kids US Food Vegetarian recipes Bread recipes Drinks Meat Dishes Brisket recipes Caribou recipes Chicken recipes Filet mignons recipes Pork recipes Swordfish recipes Turkey recipes Pasta recipes Uncategorized recipes Ethnic recipes Canada recipes English recipes Ethiopia recipes Germany recipes Greece recipes Mexican recipes Philippines recipes Welsh recipes Microwave recipes Soups recipes Vegetable recipes Asparagus recipes Barley recipes Brown rice recipes Lentil recipes Mushrooms recipes Salads recipes Wild rice Desserts recipes Cakes recipes Chocolate recipes Cookies recipes Ice cream recipes