Archive of Mr Excel Message Board

Back to Controls in Excel archive index
Back to archive home

"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

Re: "Floating" Text Box in Excel
Posted by Andy Richards on November 17, 2000 7:15 AM
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?

Re: "Floating" Text Box in Excel
Posted by Tim Francis-Wright on November 20, 2000 2:41 PM
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!

This archive is from the original message board at www.MrExcel.com.
All contents © 1998-2004 MrExcel.com.
Visit our
online store to buy searchable CD's with thousands of VBA and Excel answers.
Microsoft Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.