View Single Post
  #13   Report Post  
Posted to microsoft.public.excel.worksheet.functions
No News
 
Posts: n/a
Default selecting a single sheet from a volume of sheets in a workbook

Dear Gord Dibben

There you are.

As I am in India, I could able to see your message today only and it works
for me to meed my needs in a highly sophisticated angle and it is somthing
wonderfull.

Welldone. and thank you for your help.

These type of messages are the root of the newgroups.

Thanks.



"Gord Dibben" <gorddibbATshawDOTca wrote in message
...
Now that you know how/where to place a macro, try this one from Bob

Phillips

Sub BrowseSheets()
Const nPerColumn As Long = 38 'number of items per column
Const nWidth As Long = 13 'width of each letter
Const nHeight As Long = 18 'height of each row
Const sID As String = "___SheetGoto" 'name of dialog sheet
Const kCaption As String = " Select sheet to goto"
'dialog caption


Dim i As Long
Dim TopPos As Long
Dim iBooks As Long
Dim cCols As Long
Dim cLetters As Long
Dim cMaxLetters As Long
Dim cLeft As Long
Dim thisDlg As DialogSheet
Dim CurrentSheet As Worksheet
Dim cb As OptionButton
Application.ScreenUpdating = False
If ActiveWorkbook.ProtectStructure Then
MsgBox "Workbook is protected.", vbCritical
Exit Sub
End If
On Error Resume Next
Application.DisplayAlerts = False
ActiveWorkbook.DialogSheets(sID).Delete
Application.DisplayAlerts = True
On Error GoTo 0
Set CurrentSheet = ActiveSheet
Set thisDlg = ActiveWorkbook.DialogSheets.Add
With thisDlg
.Name = sID
.Visible = xlSheetHidden
'sets variables for positioning on dialog
iBooks = 0
cCols = 0
cMaxLetters = 0
cLeft = 78
TopPos = 40
For i = 1 To ActiveWorkbook.Worksheets.Count
If i Mod nPerColumn = 1 Then
cCols = cCols + 1
TopPos = 40
cLeft = cLeft + (cMaxLetters * nWidth)
cMaxLetters = 0
End If
Set CurrentSheet = ActiveWorkbook.Worksheets(i)
cLetters = Len(CurrentSheet.Name)
If cLetters cMaxLetters Then
cMaxLetters = cLetters
End If
iBooks = iBooks + 1
.OptionButtons.Add cLeft, TopPos, cLetters * nWidth, 16.5
.OptionButtons(iBooks).text = _
ActiveWorkbook.Worksheets(iBooks).Name
TopPos = TopPos + 13
Next i
.Buttons.Left = cLeft + (cMaxLetters * nWidth) + 24
CurrentSheet.Activate
With .DialogFrame
.Height = Application.Max(68, _
Application.Min(iBooks, nPerColumn) * nHeight + 10)
.Width = cLeft + (cMaxLetters * nWidth) + 24
.Caption = kCaption
End With
.Buttons("Button 2").BringToFront
.Buttons("Button 3").BringToFront
Application.ScreenUpdating = True
If .Show Then
For Each cb In thisDlg.OptionButtons
If cb.Value = xlOn Then
ActiveWorkbook.Worksheets(cb.Caption).Select
Exit For
End If
Next cb
Else
MsgBox "Nothing selected"
End If
Application.DisplayAlerts = False
.Delete
End With
End Sub


Gord Dibben MS Excel MVP




On Fri, 30 Jun 2006 19:42:44 +0530, "No News" wrote:

Fantastic Steve.
It has helped ver..................ry much. and thanks a lot.

If any further help is needed I can contact you. and Can I introduce your
name to my various friends of beginers to learn more.

Thanks and regards,
No News.


"Scoops" wrote in message
oups.com...

No News wrote:
Help me pls.

Hi No News

With the sheet containing the macro open:

Right-click the toolbar Customize

Click the Command tab

Scroll down the Categories and click Macros

Drag the Smiley face onto the toolbar of your choice

Right-click the Smiley Assign Macro

Click SheetFind, click OK, click Close.

Click the Smiley to run the macro.

If you want to remove the Smiley, Customize and drag it back into the
dialog box.

You can also change the way it looks: Customize, right-click Change
Button Image.

Have fun.

Regards

Steve



Gord Dibben MS Excel MVP