MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Floating Text Box in Excel


Posted by Pasi Vartiainen on November 17, 2000 1:51 AM

Is it possible to make text box to float? So, that when I scroll down sheet, textbox stays in same position? I don't want to make split of freeze, I just wan't to want to text box to stay in right top corner. This text box is updated with macro every time some cell is activated, and some help text of cell's items appear to box. Updating code code for text is ready and working, now i just wonder how to keep text box visible all the time, when user is scrolling trough sheet.

Hope that someone can help.
Pasi Vartiainen


Posted by Andy Richards on November 17, 2000 7:15 AM

Re: "Floating" Text Box in Excel

I have a similar problem with a chart I wish to anchor over frozen panes so that it says in vision as the sheet is scrolled.

Can any one help?

Posted by Tim Francis-Wright on November 20, 2000 2:41 PM

Re: "Floating" Text Box in Excel

So, that when I scroll down sheet, textbox stays in same position? I don't want to make split of freeze, I just wan't to want to text box to stay in right top corner. This text box is updated with macro every time some cell is activated, and some help text of cell's items appear to box. Updating code code for text is ready and working, now i just wonder how to keep text box visible all the time, when user is scrolling trough sheet.

You can do this by putting the following code
in the Sheet object for the worksheet in question:
(You'll need to use the Textbox control from the
Control Toolbox, not from the Drawing toolbar.)

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
With ActiveWindow.VisibleRange
' subsitute the name of the Textbox in question
TextBox1.Top = .Top + 5
TextBox1.Left = .Left + .Width - TextBox1.Width - 45
' 45 seems to be the right number of points--use fewer if you've hidden the scrollbars or the row headings
End With
End Sub

GL!