Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Greg114
 
Posts: n/a
Default Referencing a worksheet name

Hello,

I have a workbook with 10-15 worksheets with different names. I am trying to
set up a "Summary" worksheet that will have each worksheets name in column A
and then two summed columns with data from each worksheet (C4-D18 and
D31-E52).

Is there a way to reference the worksheet names in Column A within a
formula? For example, in place of SUM(Worksheet1!C4:D18) I'd like to
reference the worksheet name in column A - SUM("Column A"!C4:D18).

Thanks in advance for any assistance.
  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default

=SUM(INDIRECT("'"&A1&"'!C4:D18")

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Greg114" wrote in message
...
Hello,

I have a workbook with 10-15 worksheets with different names. I am trying

to
set up a "Summary" worksheet that will have each worksheets name in column

A
and then two summed columns with data from each worksheet (C4-D18 and
D31-E52).

Is there a way to reference the worksheet names in Column A within a
formula? For example, in place of SUM(Worksheet1!C4:D18) I'd like to
reference the worksheet name in column A - SUM("Column A"!C4:D18).

Thanks in advance for any assistance.



  #3   Report Post  
Gord Dibben
 
Posts: n/a
Default

And to easily list the names into column A

Private Sub ListSheets()
'list of sheet names starting at A1
Dim Rng As Range
Dim i As Integer
Set Rng = Range("A1")
For Each Sheet In ActiveWorkbook.Sheets
Rng.Offset(i, 0).Value = Sheet.Name
i = i + 1
Next Sheet
End Sub


Gord Dibben Excel MVP


On Wed, 23 Mar 2005 20:05:00 -0000, "Bob Phillips"
wrote:

=SUM(INDIRECT("'"&A1&"'!C4:D18")


  #4   Report Post  
Harlan Grove
 
Posts: n/a
Default

Gord Dibben wrote...
And to easily list the names into column A

Private Sub ListSheets()
'list of sheet names starting at A1
Dim Rng As Range
Dim i As Integer
Set Rng = Range("A1")
For Each Sheet In ActiveWorkbook.Sheets
Rng.Offset(i, 0).Value = Sheet.Name
i = i + 1
Next Sheet
End Sub

....

Declared *Private* in order to force the OP to run it from the VBE or
from another macro?! Simple fubar or sadistic streak?

Better to use a udf and allow the OP to decide where the list should
appear (as well as allowing the list to update on full recalcs or
kludged volatile recalcs).


Function slst( _
Optional t As String = "CMS", _
Optional r As Range _
) As Variant
'-------------------------------------------------------------
'optional 1st arg specifies which sheets to include in results
'using last char of XL4 worksheet extensions: xlC - charts,
'xlM - macros, xlS - [work]sheets -- all other chars ignored
'optional 2nd arg specifies which *OPEN* workbook's sheets
'1st defaults to all sheets, latter defaults to workbook which
'contains the calling formula.
'-------------------------------------------------------------
Const C As Long = 1, M As Long = 2, s As Long = 3
Dim rv As Variant, tt(1 To 3) As Boolean, x As Variant
Dim n As Long

If r Is Nothing Then
If TypeOf Application.Caller Is Range Then
Set r = Application.Caller
Else
Set r = ActiveCell
End If
End If

If InStr(1, t, "C", vbTextCompare) 0 Then tt(C) = True
If InStr(1, t, "M", vbTextCompare) 0 Then tt(M) = True
If InStr(1, t, "S", vbTextCompare) 0 Then tt(s) = True

ReDim rv(1 To r.Parent.Parent.Sheets.Count)

For Each x In r.Parent.Parent.Sheets
If (x.Type = -4169 And tt(C)) _
Or ((x.Type = xlExcel4MacroSheet _
Or x.Type = xlExcel4IntlMacroSheet) And tt(M)) _
Or (x.Type = xlWorksheet And tt(s)) Then
n = n + 1
rv(n) = x.Name
End If
Next x

ReDim Preserve rv(1 To n)

slst = Application.WorksheetFunction.Transpose(rv)
End Function

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
Copy from worksheet to another x times Union70 Excel Discussion (Misc queries) 0 March 7th 05 09:03 PM
Summary worksheet referencing multiple worksheets Jon Excel Worksheet Functions 1 January 27th 05 01:12 AM
Weekly Transaction Processing Ralph Howarth Excel Worksheet Functions 4 January 19th 05 05:37 AM
Indirect reference from one worksheet to another Bill Sturdevant Excel Worksheet Functions 2 December 17th 04 01:23 PM
Reference Data in Moved Worksheet tommcbrny Setting up and Configuration of Excel 1 December 1st 04 06:49 PM


All times are GMT +1. The time now is 11:02 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"