How can I make or create a floating button in Excel - Step by step

How to create a floating button in Excel

It should be noted that there are several ways to create a mobile button associated with a macro and which is always visible. Therefore, the most popular alternatives are:

Create a floating button using an auto shape

This method is one of the most practical and simple, as it allows you to give your button the shape and color you want, so:


  • First create your button with an automatic shape, to your liking.
  • Give the button a name, for example » btnExecutar «.
  • Now create a macro with the following code inside the sheet where you drew the button. This is because you need to handle the event Worksheet_SelectionChange which will be generated every time the selection is changed.

How can I make or create a floating button in Excel - Step by step



  • In this code, we tell Excel that every time we move through the sheet, we calculate the position of the cell and we assign it to the autoshape called "btnEjecutar".
  • By running this code you will have already created your floating button which will move around the Excel sheet each time we change the active cell. However, I always remind you that:
  1. With the.Left attribute of the created button, you are indicating that the distance from the left of the screen is equal to the distance of the cell that is to the right of the active cell.
  2. With the button Top attribute created, you assign the same distance that the active cell has from the top of the screen.
  3. The.Height attribute allows you to adjust the height of the active cell. You can remove this row if you have a spreadsheet with many rows of different heights.

Create a mobile user form by defining it as modeless

This method for create a floating button requires more advanced programming knowledge, therefore:




  • Open the Vba editor and add a user form.
  • On the user form, paste a button.
  • Change the caption value in the button properties window.
  • Double click the button to open the form and enter the code of one ShowModal. This will allow you to continue working on the sheet even though you have not closed the form.

How can I make or create a floating button in Excel - Step by step

  • Schedule the Workbook_Open event, if you want the button to appear on all sheets, when you open Excel

Private Secondary Workbook_Open ()

UserForm1 Show

End subtitle

  • If you want the button to appear only on a certain sheet, schedule the event in the sheet module as well

Private Secondary Worksheet_Enable ()

UserForm1.Show

End subtitle

  • Finally, if you wish, you can change the size of the User form and / or the button according to your needs.

Additional tips for modifying the code

  • If you don't want the mobile button created move column, you can remove the following line of general code.

Left = Cells (row, column + 1). Left



  • Conversely, if you want your button not to move from line to line, you can remove the next line of general code.

Top = ActiveCell.Top

  • If your sheet has many rows with different heights between them, remove the following row from the general code.

Altezza = ActiveCell.Height


How does using a floating button benefit you in Excel?

As you no longer need to manually locate object coordinates in Excel running a macro, as you will always have it in view and adjacent to the active cell. Therefore, said mobile button  it will follow you depending on the position of the active cell.

In conclusion, if you are interested in further expanding your knowledge in Excel and would like to know how to create automatic consecutive numbering using a macro of codice VBA in Excel, enter the following link.


add a comment of How can I make or create a floating button in Excel - Step by step
Comment sent successfully! We will review it in the next few hours.