View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
avveerkar[_6_] avveerkar[_6_] is offline
external usenet poster
 
Posts: 1
Default Button on a sheet always visible


Tom Ogilvy Wrote:
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


Thanks a million Tom. That should do it.
Thanks a lot to Bob also. I am closing this thread now.

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