LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,073
Default How do I keep a text box on the screen when scrolling in excel

Paulm wrote:
Thanks Ken, that's pretty cool. (A little anoying though when I'm working in
the sheet)



Hi Paul,

I agree.

Try this possible improvement, where if you double click anywhere in
the sheet the Text Box will stop tagging your selection until the next
time you double click antwhere in the sheet.
I've used a second event procedure to toggle the Text Box's selection
following behaviour.

Option Explicit
Public blnTagSelection As Boolean

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
As Boolean)
blnTagSelection = Not blnTagSelection
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If blnTagSelection Then
Dim Box As Shape
Set Box = Me.Shapes("Text Box 1")
If Selection.Left + Selection.Width _
+ Box.Width Rows(1).Width Then
Box.Left = Selection.Left - Box.Width
Else: Box.Left = Selection.Left + Selection.Width
End If
If Selection.Top + Selection.Height _
+ Box.Height Columns(1).Height Then
Box.Top = Selection.Top - Box.Height
Else: Box.Top = Selection.Top + Selection.Height
End If
Box.ZOrder msoBringToFront
End If
End Sub

Just follow the same steps to replace the old code with above code.

Ken Johnson

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How paste text from note pad to excel w/o using (Text to column) f nginhong Excel Worksheet Functions 0 April 18th 06 02:07 PM
Text records in Excel Mervyn Thomas Excel Discussion (Misc queries) 5 April 3rd 06 09:49 PM
Import text to Excel Fredrik E. Nilsen Excel Discussion (Misc queries) 2 November 21st 05 06:55 PM
TRYING TO SET UP EXCEL SPREADSHEET ON MY COMPUTER MEGTOM New Users to Excel 5 October 27th 05 03:06 AM


All times are GMT +1. The time now is 05:39 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"