Moving text box

  • Thread starter Thread starter Taylor
  • Start date Start date
T

Taylor

I would like for my text box to move with the sheet as I scroll down the page
so that the entire text box is visible regardless of my cell position. Any
tips?
 
If it moved with the sheet it would scroll off the screen as you scroll
down the page.
 
Taylor said:
I would like for my text box to move with the sheet as I scroll down the page
so that the entire text box is visible regardless of my cell position. Any
tips?

Option 1:
If you're thinking about a floating "legend",
an easy way using data validation might suffice ..

Select say, col B

Click Data > Validation > Input Message tab
Enter the title, and the input message, eg:

Title: Legend

Input message:
Ratings
---------
AAA = Triple A
AA = Double A
etc

Click OK

Select any cell in col B, and the "legend" box will be visible. Move the box
to a desired display position. Now when you scroll up / down, the "legend"
will continue to be visible in the same position (as long as the active cell
remains within col B)

Option 2:
----------------
I played with some past code by Orlando Magalhaes Filho (below)
and it seems to do the above nicely

Steps:
Draw a text box (default named:"Text Box 1") on the sheet first
[Or insert a picture, then rename it as: Text Box 1]

Then install the code by right-clicking on sheet tab > View code
then copy n paste Orlando's code into the code window
[ Adjust the x, y offsets to suit - I set these arbitrarily to 10]

'---
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
'by Orlando Magalhaes Filho in .programming
x_offset = 10
y_offset = 10
ActiveSheet.Shapes("Text Box 1").Select
With Cells(ActiveWindow.Panes(1).ScrollRow, _
ActiveWindow.Panes(1).ScrollColumn)
xpos = .Left + x_offset
ypos = .Top + y_offset
End With
With Selection
.Left = xpos
.Top = ypos
End With
Target.Select
End Sub
'---

--
Max
Singapore
http://savefile.com/projects/236895
Downloads: 15,500, Files: 352, Subscribers: 53
xdemechanik
---
 
To clarify:
I would like the text box to be visible as I scroll up and down the page.
Thanks for the heads up.
 
Back
Top