Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

How to insert floating table or textbox in Excel worksheet?

If you have a table or a textbox with some important data which you want to always be visible on the worksheet screen even though when you scroll up or down the worksheet. This may be an interesting task, this article, I will introduce a quick trick to solve it.

Insert floating table in Excel with VBA code

Insert floating textbox in Excel with VBA code


Maximize or minimize worksheet window:

To maximize the worksheet window can release more space for users, in Excel, you can maximin the worksheet window by hiding ribbon, formula bar or status bar. Kutools for Excel's Work Area can help you to hide the ribbon with only one click. Download and free trial Kutools for Excel now!

doc insert floating table 6


arrow blue right bubble Insert floating table in Excel with VBA code


There is no direct way for you to insert the floating table, so you need to convert the table data to an image, and then apply a code to finish it, please do as this:

1. Select the data table that you want to keep visible, then click Copy > Copy as Picture under the Home tab, see screenshot:

doc insert floating table 1

2. In the popped out Copy Picture dialog box, select As shown on screen from the Appearance section, and choose Picture under the Format section, click OK to close the dialog, and then click a cell to output the picture, at last, press Ctrl + V to paste this picture, see screenshot:

doc insert floating table 2

3. After converting the table to picture, then right click the sheet tab which contains the table picture that you want to keep visible always, and choose View Code from the context menu, and in the opened Microsoft Visual Basic for applications window, copy and paste the following code into the blank Module:

VBA code: Insert floating table in excel:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Updateby Extendoffice 20161116
    Application.ScreenUpdating = False
    If Target.Cells.Count > 1 Then Exit Sub
        With ActiveSheet.Shapes("Picture1")
            .Top = ActiveWindow.VisibleRange.Top + 5
            .Left = ActiveWindow.VisibleRange.Left + ActiveWindow.VisibleRange.Width - .Width - 45
        End With
    Application.ScreenUpdating = False
End Sub

Note: In this code, the Picure1 is the image name you have created, please change it to your need.

doc insert floating table 3

4. Then save and close the code window, now, when you scroll the worksheet and click a cell, the table picture is always kept on the top right corner of the worksheet.


arrow blue right bubble Insert floating textbox in Excel with VBA code

To insert a floating textbox, here is also a VBA code to solve this task.

1. First, you should insert a textbox from the Developer tab, click Developer > Insert > Text Box (ActiveX control), and then draw the textbox, and enter the information into the textbox as you need. See screenshot:

doc insert floating table 4

2. Then right click the sheet tab which contains the textbox that you want to keep visible always, and choose View Code from the context menu, and in the opened Microsoft Visual Basic for Applications window, copy and paste the following code into the blank Module:

VBA code: Insert floating textbox in Excel:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Updateby Extendoffice 20161116
    Application.ScreenUpdating = False
    With ActiveWindow.VisibleRange
        TextBox1.Top = .Top + 5
        TextBox1.Left = .Left + .Width - TextBox1.Width - 45
    End With
    Application.ScreenUpdating = True
End Sub

Note: In this code, the TextBox1 is the textbox name you have inserted, please change it to your need.

doc insert floating table 5

3. Then save and close the code window, now, when you scroll the worksheet to anywhere, the inserted textbox is always kept on the top right corner of the worksheet.


Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%

  • Reuse: Quickly insert complex formulas, charts and anything that you have used before; Encrypt Cells with password; Create Mailing List and send emails...
  • Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
  • Merge Cells/Rows/Columns without losing Data; Split Cells Content; Combine Duplicate Rows/Columns... Prevent Duplicate Cells; Compare Ranges...
  • Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
  • Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
  • Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
  • Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
  • Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
  • More than 300 powerful features. Supports Office/Excel 2007-2019 and 365. Supports all languages. Easy deploying in your enterprise or organization. Full features 30-day free trial.
kte tab 201905

Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
officetab bottom
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Thomas Maier · 3 months ago
    Hi,
    Somewhere between steps 2 and 3 on "Insert Floating Table In Excel With VBA Code" I missed how to name the picture I just copy and pasted.

    Tom
    • To post as a guest, your comment is unpublished.
      Yang Deng · 1 months ago
      Top left corner next to the box you input the formula
    • To post as a guest, your comment is unpublished.
      Peter · 2 months ago
      Same has happened to me too, how do you know the name of the picture file?
      • To post as a guest, your comment is unpublished.
        skyyang · 1 months ago
        Hello, Peter,
        To know the name of the picture, you just need to select the picture, and then view the name from the Name Box in the top left corner.
  • To post as a guest, your comment is unpublished.
    Guest · 8 months ago
    If I re-size the window, the picture floats too far into the middle. How do I make the picture float to the same margin from the screen no matter what size window I have?
  • To post as a guest, your comment is unpublished.
    Rachelle Reamer · 1 years ago
    Thank you-this solved my problem very easily!