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 Show shape on cell select, Hide shape when cell is deselected

How can the sub below be modified to a sheet level code that works like the
pop-up DV input message (ie when DV cell is selected, the input message will
show)? Or any other sub which can give the same functionality - when cell
(within a defined range on the sheet) is selected, show the shape "txt1",
when cell is deselected, hide the shape? Thanks

Sub T_Box1()
If ActiveSheet.Shapes("txt1").Visible = False Then
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: 8,520
Default Show shape on cell select, Hide shape when cell is deselected

Hi Max

Try the below..(Sheet event)

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Not Application.Intersect(Target, Range("A1:B2")) Is Nothing Then
ActiveSheet.Shapes("txt1").Visible = True
Else
ActiveSheet.Shapes("txt1").Visible = False
End If

End Sub


--
Jacob


"Max" wrote:

How can the sub below be modified to a sheet level code that works like the
pop-up DV input message (ie when DV cell is selected, the input message will
show)? Or any other sub which can give the same functionality - when cell
(within a defined range on the sheet) is selected, show the shape "txt1",
when cell is deselected, hide the shape? Thanks

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Show shape on cell select, Hide shape when cell is deselected

Thanks, Jacob. I need the shape display to sort-of follow/float next to the
cell selected (just like the DV's input message) as the defined range is a
long col eg A20:A200, and the shape won't be visible once I select cells
further down in that range
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Show shape on cell select, Hide shape when cell is deselected

OK Max. Try out the below

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Application.Intersect(Target, Range("A1:H10")) 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


--
Jacob


"Max" wrote:

Thanks, Jacob. I need the shape display to sort-of follow/float next to the
cell selected (just like the DV's input message) as the defined range is a
long col eg A20:A200, and the shape won't be visible once I select cells
further down in that range

  #5   Report Post  
Posted to microsoft.public.excel.programming
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Show shape on cell select, Hide shape when cell is deselected

Superb. Many thanks, Jacob.


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Show shape on cell select, Hide shape when cell is deselected

You are most welcome Max; and thanks for the feedback.
--
Jacob


"Max" wrote:

Superb. Many thanks, Jacob.

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
my curser changed from arrow shape to a cross shape???? bj New Users to Excel 1 February 5th 07 02:47 PM
Move shape, object, pic to center of new cell based on cell value zzxxcc Excel Programming 4 July 7th 06 12:58 PM
Show & Hide Shape in a Sheet Pete Csiszar[_2_] Excel Programming 3 January 15th 05 01:37 AM
Deleting a shape and the cell contents the shape is in. Dave Peterson[_3_] Excel Programming 1 October 9th 03 03:36 PM
Deleting a shape and the cell contents the shape is in. Tom Ogilvy Excel Programming 0 October 9th 03 03:43 AM


All times are GMT +1. The time now is 01:27 PM.

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

About Us

"It's about Microsoft Excel"