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 25th, 2002, 07:17 PM   #1
webking
New Member
 
Join Date: Mar 2002
Posts: 21
Default

I have made a sheet on which i have assigned several hyperlink which are linked with the cells present on that sheet only.
Now i uses a vba code which enable that excel file to create new sheet on the basis of current date. Now when this new sheet is formed the hyperlinks which i have assigned in the source sheet don't appear in the new sheet infact they get connected with the source sheet.
How i can make excel do this that when a new sheet is created the hyper link also adjust them selves from the previous sheet to the new sheet so that when we click on some hyperlink it take us to the desired cell on the same sheet not on the previous sheet.
webking is offline   Reply With Quote
Old Mar 25th, 2002, 09:27 PM   #2
BabyTiger
Board Regular
 
Join Date: Mar 2002
Location: Wellington
Posts: 104
Default

Hi,

You might want to try to delete all the hyperlinks in your newly copied worksheet (using the following codes):

For i = ActiveSheet.Hyperlinks.Count To 1 Step -1
ActiveSheet.Hyperlinks(i).Delete
Next i

And then add the hyperlinks to the worksheet again (using the following codes for each hyperlink):

ActiveSheet.Hyperlinks.Add Anchor:=Range("E1"), Address:="", SubAddress:=ActiveSheet.Name & "!A1"

Where "E1" is the where your hyperlink is, and "A1" is where the hyperlink links to.

HTH
BabyTiger is offline   Reply With Quote
Old Mar 27th, 2002, 12:27 AM   #3
webking
New Member
 
Join Date: Mar 2002
Posts: 21
Default

Thankyou for your help but the is it possible that some how each time when a new sheet is created from a master sheet the hyperlinks also adjust themselves for the new sheet as all other formula and headings.

webking is offline   Reply With Quote
Old Mar 27th, 2002, 12:48 AM   #4
Dave Hawley
Banned
 
Join Date: Feb 2002
Posts: 1,582
Default

Hi webking

When a hyperlink is created, you have the choice of using a Sheet AND cell reference or only a Cell Reference. It is the latter you want. This way A1 will always be A1 of the sheet the houses the Hyperlink
Dave Hawley is offline   Reply With Quote
Old Mar 27th, 2002, 01:59 AM   #5
webking
New Member
 
Join Date: Mar 2002
Posts: 21
Default

Sir thankyou but try to see this.

I have a sheet in which i have created a hyperlink which when click takes the user to cell A3.
Now when i use the following vba code for excel every new day when the user open a particular excel file a new sheet automatically is created according to the current date.
Now when this new sheet is created the hyperlink should still take the user on the A3 cell on the new sheet but in my case it takes the user on the previous sheet.
how i can solve this.

Option Explicit

Public Sub auto_open()

Dim newSheet As Worksheet
Dim yestSheet As Worksheet
Dim temp As Date
Dim tempDate As Date
On Error Resume Next
yestSheet = ActiveWorkbook.Worksheets(Format$(Date, "yyyy-mm-dd"))
If (Err.Number = 0) Then
Exit Sub
End If

tempDate = 0
On Error Resume Next
For Each yestSheet In ActiveWorkbook.Worksheets
temp = CDate(yestSheet.Name)
If (Err.Number = 0) Then
If (tempDate < temp) Then
tempDate = temp
End If
End If
Err.Clear
Next yestSheet
On Error GoTo 0
Set yestSheet = ActiveWorkbook.Worksheets("Draft")
Set newSheet = ActiveWorkbook.Worksheets.Add(yestSheet)
yestSheet.Cells.Copy newSheet.Cells
newSheet.Name = Format$(Date, "yyyy-mm-dd")
If (tempDate > 0) Then
Set yestSheet = ActiveWorkbook.Worksheets(Format$(tempDate, "yyyy-mm-dd"))
yestSheet.Range("E9:E28").Copy production closing balance
newSheet.Range("B9:B28").PasteSpecial xlPasteValues opening balance of next day in production.
yestSheet.Range("K9:K28").Copy
newSheet.Range("H9:H28").PasteSpecial xlPasteValues
End If
newSheet.Range("C1").Value = Format(Date, "Short Date")
newSheet.Range("E1").Value = Format$(Date, "dddd")
Set newSheet = Nothing
Set yestSheet = Nothing
End Sub
webking is offline   Reply With Quote
Old Mar 27th, 2002, 03:05 AM   #6
Dave Hawley
Banned
 
Join Date: Feb 2002
Posts: 1,582
Default

Webking, the problem is not in your VBA code it's the hyperlink itself. Do this.

Select any cell
Push Ctrl+K
Click "Bookmark"
Type A1 in the "type in cell reference box"
DO NOT SELECT A SHEET
Click OK, then OK agian

Now copy this sheet, or cell or cells to any other sheet. The hperlink will be relative the sheet it resides on.



_________________
Kind Regards
Dave Hawley
OzGrid Business Applications
Microsoft Excel/VBA Training


[ This Message was edited by: Dave Hawley on 2002-03-27 02:05 ]
Dave Hawley is offline   Reply With Quote
Old Mar 27th, 2002, 03:47 PM   #7
webking
New Member
 
Join Date: Mar 2002
Posts: 21
Default

Tommy,
thanks a lot for helping me so much , do you have some information about vba ? if yes iam trying to solve a problem from last 3 weeks but no use. I have discuss this with so many discussion forum and went through books but did not get any answer.

Suppose there is excel sheet in a file name "Daily" on which Cell A1, B1, C3 has values input. Now i want to create a link from this sheet to another excel file named "Weekly".
Now if the source sheet "Daily" remains same then when ever we make entries in the linked cell the "Weekly" Sheet get updated but the problem is sheet in the file "Daily" get changed every day and the "Weekly" Sheet should have some kind of link so that each day it get result from different sheet from the same mentioned cells and get updated. Like on March 21 data from Cell A1, B1, C5 gets into the "Weekly" File Sheet cell A1, B1, C1 , n0w on March 22 data from same excel cell but the sheet will change should go into "Weekly" file sheet in cell A2,B2,C2
If the above is not clear here some more explaination:-please bear with me on this one..





Like Suppose the code i mentioned to you creates new sheet according the current date with the same formula and headings and some copy paste that i like from previous sheet which i have used.
Now all this happen in a single file of excel that on each new day a new sheet automatically comes in act when ever that particular file is opened.

Now suppose this excel file has a name "DAILY" in which each day a new sheet automatically comes in act and in this new sheet suppose we do entries in CELL A1, C5, C9.

I want to create a link between this sheet and another file which has a name "WEEKLY" on which the sheet shows the summary of 7 days input or if not 7 shows summary of all the sheets that has been used in "DAILY" file.
Now this would have been easy if the source sheet is not changed but the problem is each day the source sheet is changed and so the connection of the sheet with the weekly file sheet does not remain.
Now iam looking for such a vba code like i have for excel so that excel can perform the above daily to weekly function.


webking is offline   Reply With Quote
Old Mar 27th, 2002, 03:51 PM   #8
webking
New Member
 
Join Date: Mar 2002
Posts: 21
Default

Sorry for writing tommmy , iam thankful to Dave. and i hope you can help me on the vba problem also
webking 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 11:08 AM.


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