Excel help Sheet Name...linking into Spreadsheet
15-08-2005, 08:24
|
#1
|
|
Inactive
Join Date: Jan 2004
Age: 64
Posts: 2,242
|
Excel help Sheet Name...linking into Spreadsheet
Hi all
Quick Excel question !
I have a spreadsheet with lots of named pages...ie tabs at the bottom. Can I link these into the actaul spreadsheet rather then typing them all in or setting headers. Ie in a cell sort of : A1 = sheet name.
Any ideas
Thanks
Mike
|
|
|
15-08-2005, 08:53
|
#2
|
|
Inactive
Join Date: Mar 2004
Location: Glasgow, Scotland
Services: anything for a new job
Posts: 4,165
|
Re: Excel help Sheet Name...linking into Spreadsheet
I done a search for linking worksheets to cells in excel, and it gave me this:
Examples
The following example opens a worksheet named Budget Report.xls that is stored on the Internet at the location named example.microsoft.com/report and displays the text "Click for report":
=HYPERLINK("http://example.microsoft.com/report/budget report.xls", "Click for report")
The following example creates a hyperlink to cell F10 on the worksheet named Annual in the workbook Budget Report.xls, which is stored on the Internet at the location named example.microsoft.com/report. The cell on the worksheet that contains the hyperlink displays the contents of cell D1 as the jump text:
=HYPERLINK("[http://example.microsoft.com/report/budget report.xls]Annual!F10", D1)
The following example creates a hyperlink to the range named DeptTotal on the worksheet named First Quarter in the workbook Budget Report.xls, which is stored on the Internet at the location named example.microsoft.com/report. The cell on the worksheet that contains the hyperlink displays the text "Click to see First Quarter Department Total":
=HYPERLINK("[ http://example.microsoft.com/report/budget report.xls]First Quarter!DeptTotal", "Click to see First Quarter Department Total")
although you don't have to use an internet domain name, you could just navigate to the file you want, and it should find the file, and get the required data.
ik
EDIT: or this:
create a link between cells in the same worksheet or workbook- Click the cell that contains the data you want to link to, and then click Copy [img]../images/0019.gif[/img] on the Standard toolbar.
- Click the cell you want to link from, and then click Paste [img]Download Failed (1)[/img].
- Click Paste Options [img]Download Failed (1)[/img] and then click Link Cells.
[img]../images/bluedrop.gif[/img]Create a link between cells in different workbooks- Open both the workbook that will contain the link (called the destination workbook), and the workbook that contains the data you want to link to (called the source workbook).
- In the destination workbook, click Save [img]../images/0003.gif[/img].
- Select a cell or cells you want to link from.
- If you are creating a new formula, type = (an equal sign). If you are entering the link elsewhere in the formula, type the operator or function that you want to precede the link.
- On the Window menu, click the name of the source workbook, and then click the worksheet that contains the cells you want to link to.
- Select the cells you want to link to.
- Complete the formula. When you finish entering the formula, press ENTER.
Or:
if on the same workbook
=sheet2!B2 (uses value in cell B2 on worksheet 2)
|
|
|
15-08-2005, 09:05
|
#3
|
|
Inactive
Join Date: Jul 2003
Posts: 2,820
|
Re: Excel help Sheet Name...linking into Spreadsheet
As Ikthius said you can create hyperlinks to a complete sheet - but I am wondering if you want to link to a CELL in a different sheet. If so it's as easy as putting your forumula in the cell and then (instead of clicking to get the value of a cell on that sheet) click the tab of the sheet you want, then the cell in that sheet, and press enter.
|
|
|
15-08-2005, 09:38
|
#4
|
|
Inactive
Join Date: Jan 2004
Age: 64
Posts: 2,242
|
Re: Excel help Sheet Name...linking into Spreadsheet
I have a spreadsheet with about 30 named sheets and I want to copy a formula on each sheet to 'pick up' the sheet name. Hope that makes sense.
Thanks
Mike
|
|
|
15-08-2005, 10:05
|
#5
|
|
Inactive
Join Date: Jun 2003
Location: Belfast
Age: 46
Posts: 4,594
|
Re: Excel help Sheet Name...linking into Spreadsheet
Use this forumula
=MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,34)
Basically the =(cell("filename")) function returns - c:\data\[book1.xls]sheetname
The formula above returns whatever is after the ] ie the sheetname.
|
|
|
15-08-2005, 10:40
|
#6
|
|
Inactive
Join Date: Jan 2004
Age: 64
Posts: 2,242
|
Re: Excel help Sheet Name...linking into Spreadsheet
Quote:
|
Originally Posted by gazzae
Use this forumula
=MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,34)
Basically the =(cell("filename")) function returns - c:\data\[book1.xls]sheetname
The formula above returns whatever is after the ] ie the sheetname.
|
Thanks for this but just comes up with #Value!
Mike
|
|
|
15-08-2005, 11:08
|
#7
|
|
Inactive
Join Date: Jun 2003
Location: Belfast
Age: 46
Posts: 4,594
|
Re: Excel help Sheet Name...linking into Spreadsheet
Quote:
|
Originally Posted by Mike
Thanks for this but just comes up with #Value!
Mike
|
The sheet has to be saved for the "filename" formula to work. If its not saved you will get the #Value!
|
|
|
15-08-2005, 12:07
|
#8
|
|
Inactive
Join Date: Jan 2004
Age: 64
Posts: 2,242
|
Re: Excel help Sheet Name...linking into Spreadsheet
Quote:
|
Originally Posted by gazzae
The sheet has to be saved for the "filename" formula to work. If its not saved you will get the #Value!
|
Gazzae
Worked many thanks for everyone help
|
|
|
15-08-2005, 13:07
|
#9
|
|
Inactive
Join Date: Jun 2003
Location: Surrey
Age: 59
Services: Virgin stuff
Posts: 6,407
|
Re: Excel help Sheet Name...linking into Spreadsheet
If you created a Module and add this code to it, the sheet names will appear in the first column on Sheet1.
Quote:
Function SheetNames() As Variant
Dim SheetN As String
Dim SheetN2() As Variant
Dim SheetCount As Integer
Dim x As Integer
Application.Volatile
x = 1
SheetCount = Worksheets.Count
Worksheets(1).Range("A:A").Clear
For x = 1 To SheetCount
With Worksheets
SheetN = .Item(x).Name
End With
ReDim Preserve SheetN2(SheetCount)
SheetN2(x) = SheetN
Worksheets(1).Cells(x, 1).Value = SheetN2(x)
Next
End Function
Sub SheetName()
Call SheetNames
End Sub
|
It also creates a Macro called Sheetname that can be run to update the list if any are added or taken away.
It's basic, but does the job.
|
|
|
15-08-2005, 13:39
|
#10
|
|
Inactive
Join Date: Jun 2003
Location: Surrey
Age: 59
Services: Virgin stuff
Posts: 6,407
|
Re: Excel help Sheet Name...linking into Spreadsheet
Changed it Slightly to be a bit more generic
|
|
|
15-08-2005, 13:41
|
#11
|
|
Inactive
Join Date: Jan 2004
Age: 64
Posts: 2,242
|
Re: Excel help Sheet Name...linking into Spreadsheet
Quote:
|
Originally Posted by Simon M
If you created a Module and add this code to it, the sheet names will appear in the first column on Sheet1.
It also creates a Macro called Sheetname that can be run to update the list if any are added or taken away.
It's basic, but does the job.
|
Looks good but how do you create a Module
thanks Mike
|
|
|
15-08-2005, 13:42
|
#12
|
|
Inactive
Join Date: Jun 2003
Location: Surrey
Age: 59
Services: Virgin stuff
Posts: 6,407
|
Re: Excel help Sheet Name...linking into Spreadsheet
Tools ... Macro ... Visual basic Editor .... Insert ... Module
Paste the code in, save ... and away you go
|
|
|
15-08-2005, 14:13
|
#13
|
|
Inactive
Join Date: Jun 2003
Location: Belfast
Age: 46
Posts: 4,594
|
Re: Excel help Sheet Name...linking into Spreadsheet
Quote:
|
Originally Posted by Simon M
If you created a Module and add this code to it, the sheet names will appear in the first column on Sheet1.
It also creates a Macro called Sheetname that can be run to update the list if any are added or taken away.
It's basic, but does the job.
|
Complicated!
This does the same..
Quote:
For i = 1 To Sheets.Count
Worksheets(1).Cells(i, 1) = Worksheets(i).Name
Next i
|
|
|
|
15-08-2005, 14:15
|
#14
|
|
Inactive
Join Date: Jun 2003
Location: Surrey
Age: 59
Services: Virgin stuff
Posts: 6,407
|
Re: Excel help Sheet Name...linking into Spreadsheet
Quote:
|
Originally Posted by gazzae
Quote:
|
Originally Posted by Simon M
If you created a Module and add this code to it, the sheet names will appear in the first column on Sheet1.
It also creates a Macro called Sheetname that can be run to update the list if any are added or taken away.
It's basic, but does the job.
|
Complicated!
This does the same..
Quote:
For i = 1 To Sheets.Count
Worksheets(1).Cells(i, 1) = Worksheets(i).Name
Next i
|
|
Yep, I was trying to do some other stuff with the sheet names, and so needed them in variables, but your's does the the basic listing without needing the variables.
|
|
|
15-08-2005, 15:32
|
#15
|
|
Inactive
Join Date: Jun 2003
Location: Surrey
Age: 59
Services: Virgin stuff
Posts: 6,407
|
Re: Excel help Sheet Name...linking into Spreadsheet
k, with a little more playing ...
Create a Module, as per above.
Put this code in.
Quote:
Function SheetName() As Variant
For i = 1 To Worksheets.Count
Worksheets(i).Range("A1:A1").Clear
Worksheets(i).Cells(1, 1).Value = Worksheets.Item(i).Name
Next
End Function
Sub NameSheets()
Call SheetName
End Sub
|
Double click on "ThisWorksheet" and add this code.
Quote:
Private Sub Workbook_Open()
Call SheetName
End Sub
|
This will automatically run the function when the Workbook opens and place the name of the sheet in Cell A1 on each sheet.
In addition there is a Macro which can be used when things have been changed, added or removed.
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT. The time now is 13:34.
|