is it possible to make a command button "Float"

whiteghost

Well-known Member
Joined
Nov 22, 2002
Messages
500
Hi is it possible to make a command button stay in one part of screen even when the user scrolls up or down?
at the moment Ihave the buttons on row1 and the panes frozen.
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
You could try two workarounds.

One is to place the command button or such icon on a custom floating toolbar by itself.

The other option, depending on how ubiquitous you want the command button to be, is to place this code in your sheet module. Modify for CommandButton reference and how far away you want it from your selected cell.

This has its drawbacks though...for one you lose your undo feature, and for another, the button will be like your shadow, always there but maybe that's what you want. Modify the offsets and Exit Sub line to suit.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column < 3 Or Target.Row < 3 Then Exit Sub
With ActiveSheet.Shapes("CommandButton1")
.Top = Target.Offset(-2).Top
.Left = Target.Offset(, -2).Left
End With
End Sub
 
Upvote 0
this solution is exactly what I've implemented some time back and have only just realised that the worksheet looses its copy/paste functionality ...

any ideas as to why ? as also how to resolve this issue


thanks

Regds

Tom

You could try two workarounds.

One is to place the command button or such icon on a custom floating toolbar by itself.

The other option, depending on how ubiquitous you want the command button to be, is to place this code in your sheet module. Modify for CommandButton reference and how far away you want it from your selected cell.

This has its drawbacks though...for one you lose your undo feature, and for another, the button will be like your shadow, always there but maybe that's what you want. Modify the offsets and Exit Sub line to suit.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column < 3 Or Target.Row < 3 Then Exit Sub
With ActiveSheet.Shapes("CommandButton1")
.Top = Target.Offset(-2).Top
.Left = Target.Offset(, -2).Left
End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,990
Messages
6,175,816
Members
452,672
Latest member
missbanana

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top