-
This won't work for scrolling,
but if by "follow the cursor" you mean follow a selection change, then perhaps something like this:
[vba]Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Shp As Object
Set Shp = ActiveSheet.CommandButton1
With Shp
.Left = ActiveCell.Left
.Top = ActiveWindow.Top
.Width = Range("A1").Width ' or a desired fixed width
.Height = Range("A1").Height ' or a desired fixed height
End With
Shp.Object.TakeFocusOnClick = False'Optional. keeps focus on the selected cell instead of the button
End Sub
[/vba]
Last edited by frank_m; 09-09-2011 at 12:31 PM.
Reason: edited the code comments
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules