Thread: Buttons
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Colo Colo is offline
external usenet poster
 
Posts: 62
Default Buttons

Hi, Daniel,
This code would make buttons on the top of a sheet.
Before run this code, please be sure to add NAMES( from Insert Names.) to
the ranges where that title
appears.


'-- CODE ----------------------------------------------
Sub MakeButtons()
Dim n As Name
Dim rng As Range
Dim i As Long
For Each n In ThisWorkbook.names
On Error Resume Next
Set rng = Range(n)
If Not Err.Number < 0 Then
i = i + 1
With Sheets(1).Cells(i, 1)
With .Parent.Buttons.Add(.Left, .Top, .Width, .Height)
.Caption = n.Name
.OnAction = "'GotoRange" & Chr$(34) & rng.Parent.Name &
"!" & _
rng.Address & Chr$(34) & "'"
With .Characters(Start:=1, Length:=Len(n.Name)).Font
.Name = "Verdana"
.Size = 9
End With
End With
End With
End If
Next
Set rng = Nothing
End Sub

Sub GotoRange(ByVal Target)
Application.Goto Range(Target)
End Sub
'-------------------------------------------------------


--
Kind Regards
Colo
/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
Colo of 'The Road of The Cell Masters' :)

URL:http://www.interq.or.jp/sun/puremis/...astersLink.htm


/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/



"Daniel" wrote in message
...
Hello, I would like to put 100 buttons or so on the top of a sheet and
would like to be able to click on anyone of them so that the action would

be
to go down the same sheet or another sheet directly to where that title
appears. Can someone suggest me a way?

Thanks you

Daniel