Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Tweak to display autoshape

Seeking a tweak to the sub below. Currently it displays "txt1" aligned with
the top edge of the selected cell, just to the right of it. Unfortunately
this position obscures immediate cols to the right of the selected cell,
which user occasionally needs to see. I want to "push" the display vertically
down a bit and align the top edge of "txt1" just below the bottom edge of the
selected cell so that user can see the contents in the adjacent cells. Thanks
----------
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Not Application.Intersect(Target, Range("A31:A200")) Is Nothing Then
Me.Shapes("txt1").Left = Target.Left + Target.Width
Me.Shapes("txt1").Top = Target.Top
ActiveSheet.Shapes("txt1").Visible = True
Else
ActiveSheet.Shapes("txt1").Visible = False
End If

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Tweak to display autoshape

Hi Max,

As well as answering your question, the following method shows an
alternative method instead of adding the cell width for the Left position.
See comment for adjusting the top of txt1 if you don't want it exactly at the
bottom of the Target.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Not Application.Intersect(Target, Range("A31:A200")) Is Nothing Then

'Can use use Offset as alternative method to adding width
Me.Shapes("txt1").Left = Target.Offset(0, 1).Left

'Adjust + 2 by experimenting for how far below
'the bottom of the cell txt1 is required.
Me.Shapes("txt1").Top = Target.Offset(1, 0).Top + 2

ActiveSheet.Shapes("txt1").Visible = True
Else
ActiveSheet.Shapes("txt1").Visible = False
End If

End Sub

--
Regards,

OssieMac


"Max" wrote:

Seeking a tweak to the sub below. Currently it displays "txt1" aligned with
the top edge of the selected cell, just to the right of it. Unfortunately
this position obscures immediate cols to the right of the selected cell,
which user occasionally needs to see. I want to "push" the display vertically
down a bit and align the top edge of "txt1" just below the bottom edge of the
selected cell so that user can see the contents in the adjacent cells. Thanks
----------
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Not Application.Intersect(Target, Range("A31:A200")) Is Nothing Then
Me.Shapes("txt1").Left = Target.Left + Target.Width
Me.Shapes("txt1").Top = Target.Top
ActiveSheet.Shapes("txt1").Visible = True
Else
ActiveSheet.Shapes("txt1").Visible = False
End If

End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Tweak to display autoshape

Hi Max

Add the target height as below..

Me.Shapes("txt1").Top = Target.Top + Target.Height

--
Jacob (MVP - Excel)


"Max" wrote:

Seeking a tweak to the sub below. Currently it displays "txt1" aligned with
the top edge of the selected cell, just to the right of it. Unfortunately
this position obscures immediate cols to the right of the selected cell,
which user occasionally needs to see. I want to "push" the display vertically
down a bit and align the top edge of "txt1" just below the bottom edge of the
selected cell so that user can see the contents in the adjacent cells. Thanks
----------
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Not Application.Intersect(Target, Range("A31:A200")) Is Nothing Then
Me.Shapes("txt1").Left = Target.Left + Target.Width
Me.Shapes("txt1").Top = Target.Top
ActiveSheet.Shapes("txt1").Visible = True
Else
ActiveSheet.Shapes("txt1").Visible = False
End If

End Sub

  #4   Report Post  
Posted to microsoft.public.excel.programming
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Tweak to display autoshape

Many thanks, OssieMac. Appreciate the learnings as well.

  #5   Report Post  
Posted to microsoft.public.excel.programming
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Tweak to display autoshape

Many thanks, Jacob. Congrats on your MVP attainment!


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Tweak to display autoshape

Thanks Max...

--
Jacob (MVP - Excel)


"Max" wrote:

Many thanks, Jacob. Congrats on your MVP attainment!

Reply
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
Automatically change autoshape color to that of another autoshape T-bone Excel Programming 2 October 24th 08 01:43 AM
Display autoshape with circumstances [email protected] Excel Programming 0 November 9th 06 04:36 PM
Code Tweak bodhisatvaofboogie Excel Programming 1 July 21st 06 04:37 PM
Display AutoShape in UserForm bforster1[_28_] Excel Programming 1 November 3rd 05 02:09 PM
macro in vba to display autoshape jrd269[_6_] Excel Programming 0 June 7th 05 08:45 PM


All times are GMT +1. The time now is 03:59 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"