Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default get name of sheets

I am creating a simple envelope budgeting sheet. On my first sheet, I
would like to have a list of all the other sheets ('envelopes') and
their balance. Each 'envelope' sheet has its current balance in cell
A7 and I would like to access that as well.

So my first sheet would have something like:

8 | 9
D <name of second sheet| value of A7 on second sheet
E <name of third sheet | value of A7 on third sheet
....

If possible, I would like this to be automatic so when I add another
envelope sheet, its name and A7 value would show up on the first sheet.

Finally, would it be possible to detect a double click on the sheet
name and
then switch to that sheet?

Thanks in advance for any help.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default get name of sheets

This will add hyperlinks on sheet1 to each of the following sheets, 2, 3, 4,
etc. The hyperlink text will be the sheet name, the cell under it will be
the value from cell A7 on that sheet. The sheet names will begin on sheet1,
range D8 and continue for each column to the right for as many sheets you
have.

Sub test()
Dim i As Long
Dim DataClmn As Long
Dim ShtName As String

DataClmn = 4
For i = 2 To Worksheets.Count
ShtName = Worksheets(i).Name

With Worksheets(1)
.Hyperlinks.Add Anchor:=.Cells(8, DataClmn), _
Address:="", _
SubAddress:=ShtName & "!A7", _
ScreenTip:="", _
TextToDisplay:=ShtName & ""
.Cells(9, DataClmn).Value = Worksheets(i).Range("A7").Value
End With
DataClmn = DataClmn + 1

Next i
End Sub

Mike F
wrote in message
ups.com...
I am creating a simple envelope budgeting sheet. On my first sheet, I
would like to have a list of all the other sheets ('envelopes') and
their balance. Each 'envelope' sheet has its current balance in cell
A7 and I would like to access that as well.

So my first sheet would have something like:

8 | 9
D <name of second sheet| value of A7 on second sheet
E <name of third sheet | value of A7 on third sheet
...

If possible, I would like this to be automatic so when I add another
envelope sheet, its name and A7 value would show up on the first sheet.

Finally, would it be possible to detect a double click on the sheet
name and
then switch to that sheet?

Thanks in advance for any help.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default get name of sheets

Works great. The only problem I am haing is with sheet names with
spaces or '-' in the name.

Can I use sheet names with spaces?

Thanks.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default get name of sheets

Yes spaces and hyphens are OK in sheet names. Could you describe the exact
problem you are having?

Mike F
wrote in message
oups.com...
Works great. The only problem I am haing is with sheet names with
spaces or '-' in the name.

Can I use sheet names with spaces?

Thanks.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default get name of sheets

Also sheet names that are a date like Sep-05 were a problem when displayed
on sheet1. Excel used it's date recognition feature to screw it up. Here is
the modified code that should work with any sheet name.

Dim i As Long
Dim DataClmn As Long
Dim ShtName As String

DataClmn = 4
For i = 2 To Worksheets.Count
ShtName = Worksheets(i).Name

With Worksheets(1)
.Hyperlinks.Add Anchor:=.Cells(8, DataClmn), _
Address:="", _
SubAddress:="'" & ShtName & "'!A7", _
ScreenTip:="", _
TextToDisplay:="'" & ShtName
.Cells(9, DataClmn).Value = Worksheets(i).Range("A7").Value
End With
DataClmn = DataClmn + 1

Next i
End Sub

Mike F


"Mike Fogleman" wrote in message
...
Yes spaces and hyphens are OK in sheet names. Could you describe the exact
problem you are having?

Mike F
wrote in message
oups.com...
Works great. The only problem I am haing is with sheet names with
spaces or '-' in the name.

Can I use sheet names with spaces?

Thanks.







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default get name of sheets

Thanks!

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to update data from multiple sheets to one specific sheets Khawajaanwar Excel Discussion (Misc queries) 4 January 15th 10 07:31 AM
Multiple Sheets (Need to create 500 individual sheets in one workbook, pulling DATA Amaxwell Excel Worksheet Functions 4 August 17th 06 06:23 AM
How to repeat a code for selected sheets (or a contiguous range of sheets) in a Workbook? Dmitry Excel Worksheet Functions 6 March 29th 06 12:43 PM
In 3 active sheets in wkbk, determine& display the # of sheets that have data wrpalmer Excel Discussion (Misc queries) 1 November 4th 05 02:01 PM
Allocate Files to Sheets and Build a Master Sheet which Summarises All Sheets hanuman Excel Programming 0 September 9th 03 11:23 AM


All times are GMT +1. The time now is 10:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"