LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Table of Contents with Page Numbers

G'day all

I have been using Don Guillett's excellent code (copied below) to create a
automatic Table of Contents.

Is there any way to automatically include page numbers to the right of the
list of sheet names (obviously in its own cells)? Also I have information
which is to be manually entered against the list on the left of the list of
sheet names, so any code would have to take into account this as well.

Also I took out the sort function as I don't need it.

FYI - Don's code starts on A1 of the sheet. I wanted it to start on a
different cell so I made the following changes to make the list start at C3.

Cells(i, 1).Value = ms to Cells(3 + i, 3).Value = ms
If Target.Column < 1 Then Exit Sub to If Target.Column < 3 Then Exit Sub

Thanks to all.

Don Guillett's Code
Private Sub Worksheet_Activate()
Dim i As Long
Dim ms As String

For i = 1 To Sheets.Count
ms = Sheets(i).Name
'MsgBox ms
If ms < ActiveSheet.Name Then
Cells(i, 1).Value = ms
End If
Next i
'sorts list
Columns("a").sort key1:=Cells(2, 1)
End Sub
'=======
Private Sub Worksheet_BeforeDoubleClick _
(ByVal Target As Range, Cancel As Boolean)
If Target.Column < 1 Then Exit Sub
Application.DisplayAlerts = False
Dim WantedSheet As String
WantedSheet = Trim(ActiveCell.Value)
If WantedSheet = "" Then Exit Sub
On Error Resume Next
If Sheets(WantedSheet) Is Nothing Then
'GetWorkbook ' calls another macro to do that
Else
Application.GoTo Sheets(WantedSheet).Range("a4")
End If
Application.DisplayAlerts = True
End Sub

 
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
Table of Contents with Page Numbers Art Vandelay Excel Discussion (Misc queries) 0 December 3rd 09 12:31 AM
Contents Page Rich Excel Discussion (Misc queries) 1 March 8th 06 05:34 AM
merging documents,exporting long landscape table to word with page breaks & numbers guillemot Excel Discussion (Misc queries) 4 February 6th 06 08:57 AM
start page numbering after table of contents J. Williams Excel Discussion (Misc queries) 1 February 4th 06 12:07 PM
Automatically print all page contents in pivot table. David P Excel Worksheet Functions 0 February 21st 05 05:57 PM


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