Thread: floating button
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
JLatham JLatham is offline
external usenet poster
 
Posts: 3,365
Default floating button

Gary''s Student has offered a good suggestion. If you need help implementing
it, let us know. I have some code that would work for you to do this and
could post it here to help out with it. If you do ask for that help, it
would be a good thing if you would post the name of the macro that executes
now when you click on your 'histories' button. It needs to be in the code.

"Jack Sons" wrote:

Hi all,

On my worksheet I have a button of which the name is "historie". When
clicked it starts a certain macro.
The sheet is rather wide, col. A up to col. FH.
The button is now in a fixed position, in cell A1 but I want the button to
float so that when I scroll more than 16 columns to the right the button
will appear in the upper left corner of the then visible part of the
worksheet as soon as I select a cell in the that part of the worksheet.
From one of the helpful persons in this NG many years ago I got the code
below - which I put in the program module of the worksheet - and it worked
well. I want to get that effect again but the button remains fixed to its
original positition.
What is wrong? Thanks in advance for your help.

Jack Sons
The Netherlands



Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.DisplayCommentIndicator = xlCommentIndicatorOnly
If ActiveCell.Column 16 Then

Dim myShape As Shape

Set myShape = Me.Shapes("historie")

With Me.Cells(ActiveWindow.ScrollRow, ActiveWindow.ScrollColumn)
'With Me.Cells(1, ActiveWindow.ScrollColumn)
myShape.Top = 30 '.Top
myShape.Left = .Left
End With
End If
End Sub