View Single Post
  #12   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Button on a sheet always visible

There is no event associated with a window Scroll. You could use the
selection change event which will work more often than required, but should
do the job.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Static Oldrange As Range
Dim rng As Range, rng1 As Range

If Oldrange Is Nothing Then
Set Oldrange = ActiveWindow.VisibleRange
Exit Sub
End If
If ActiveWindow.VisibleRange.Address < _
Oldrange.Address Then
Set rng = ActiveWindow.VisibleRange
Set rng1 = rng(rng.Count).Offset(-2, -2)
CommandButton1.Top = rng1.Top
CommandButton1.Left = rng1.Left
End If


right click on the sheet tab and select view code. Put in code like the
above in the resulting module.

--
Regards,
Tom Ogilvy



"avveerkar" wrote
in message ...

Tom Ogilvy Wrote:
Put in a split screen with the small area at the bottom. Scroll you
button
into view in the bottom pane.

Window=split, then drag the verticle bar to one side and drag the
horizontal bar toward the bottom

--
Regards,
Tom Ogilvy

Thanks Tom. That is good work around I can use. Small drawback though
is I will always have those Split Bars seen on the sheet which is a
little uncomfortable. I was wondering if it is possible to fix the
position of the button static in a window by appropriately coding. To
draw a button we need to specify it coordinates ( top edge and left
edge position ). Is it possible to sense scroll position of the sheet
and then redraw the button accordingly so that it would appear to be
static while scrolling.

A V Veerkar



--
avveerkar
------------------------------------------------------------------------
avveerkar's Profile:

http://www.excelforum.com/member.php...o&userid=30338
View this thread: http://www.excelforum.com/showthread...hreadid=500050