Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
list the sheets in a workbook
I need to be able to list the names of the sheets contained in a workbook.
|
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
list the sheets in a workbook
here is a vb.net example that should work for ya.
Dim sheet As Excel.Worksheet Dim ODOC As Excel.Workbook ................ Dim worksheetname As String For Each sheet In ODOC.Worksheets Console.WriteLine(sheet.Name) Next "Listing of Excel shhets in a workbook" wrote: I need to be able to list the names of the sheets contained in a workbook. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
list the sheets in a workbook
Function ListSheets() As String
For Each sht In ActiveWorkbook.Sheets ListSheets = ListSheets & "," & sht.Name Next End Function Sub aa() MsgBox Mid(ListSheets, 2) End Sub Run the sub aa to get a comma delimited string containing the names of the sheets. If you want to include worksheets only, replace ActiveWorkbook.Sheets by ActiveWorkbook.Worksheets. "Listing of Excel shhets in a workbook" wrote: I need to be able to list the names of the sheets contained in a workbook. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
list the sheets in a workbook
Dim ODOC As Excel.Workbook Dim sheet As Excel.Worksheet ....... Dim worksheetname As String For Each sheet In ODOC.Worksheets Console.WriteLine(sheet.Name) Next "Listing of Excel shhets in a workbook" wrote: I need to be able to list the names of the sheets contained in a workbook. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
list the sheets in a workbook
sStr = ""
for each sh in Activeworkbook.sheets sStr = sStr & sh.Name & vbNewLine Next msgBox sStr -- Regards, Tom Ogilvy "Listing of Excel shhets in a workbook" <Listing of Excel shhets in a wrote in message ... I need to be able to list the names of the sheets contained in a workbook. |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
list the sheets in a workbook
Listing of Excel shhets in a workbook wrote:
I need to be able to list the names of the sheets contained in a workbook. Here are a couple of ways: Sub qwerty4() 'Workbook must have reference to Microsoft Scripting Runtime Dim dic As Dictionary, rng As Range Set dic = New Dictionary Set rng = Range("A1:A" & ActiveWorkbook.Sheets.Count) For Each sh In ActiveWorkbook.Sheets dic.Add CStr(sh.Name), sh.Name Next rng.Value = Application.Transpose(dic.Items) End Sub Sub qwerty5() Dim arr, rng As Range Dim i As Integer, n As Integer, m As Object Set m = ActiveWorkbook.Sheets n = m.Count Set rng = Range("A1:A" & n) ReDim arr(1 To n, 1 To 1) i = 1 For Each sh In m arr(i, 1) = sh.Name i = i + 1 Next rng.Value = arr End Sub Alan Beban |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Print list of names of all sheets in a workbook | Excel Discussion (Misc queries) | |||
list sheets in workbook | Excel Discussion (Misc queries) | |||
List all sheets present in Workbook | Excel Worksheet Functions | |||
Multiple Sheets (Need to create 500 individual sheets in one workbook, pulling DATA | Excel Worksheet Functions | |||
How do you list all the workbooks you have opened and the sheets in each workbook? | Excel Programming |