Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 270
Default AutoShape Re-Sizing IS KILLING ME!!!!

I have added an autoshape, then copied an Excel table over to it, and grouped
them together. In VB there is the following code, that brings up the
autoshape whenever someone clicks on a cell in the range of L2:L200, and
anchors the shape to that cell:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Box190 As Shape
Set Box190 = Me.Shapes("Group 190")

If Not (Intersect(Target, Range("L2:L200")) Is Nothing) Then
With Target
Shapes("Group 190").Visible = True
If Selection.Left + Selection.Width + Box190.Width Rows(1).Width
Then
Box190.Left = Selection.Left - Box190.Width
Else: Box190.Left = Selection.Left + Selection.Width
End If
If Selection.Top + Selection.Height + Box190.Height
Columns(1).Height Then
Box190.Top = Selection.Top - Box190.Height
Else: Box190.Top = Selection.Top + Selection.Height
End If
Box190.ZOrder msoBringToFront
End With
Else: Shapes("Group 190").Visible = False
End If

The problem is that the autoshape keeps changing sizes, I assume as a result
of other copy/paste/clear actions taken at different times. I have tried
setting the format of each autoshape (including the original shape, the
picture added, and the group) to all variations possible...don't move/size,
etc. When the other macros are run to copy/paste/clear, I set
application.enableevents to false. I can't figure out why the size of the
shapes keeps changing, and was wondering if it had something to do with the
above code .

Am really really frustrated with this and was hoping someone out there could
help me.....thanks so much.....
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default AutoShape Re-Sizing IS KILLING ME!!!!

Just a guess but right click on the shape and go to Format - Properties.
What is the option selected in terms of moving and sizing?
--
HTH...

Jim Thomlinson


"Paige" wrote:

I have added an autoshape, then copied an Excel table over to it, and grouped
them together. In VB there is the following code, that brings up the
autoshape whenever someone clicks on a cell in the range of L2:L200, and
anchors the shape to that cell:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Box190 As Shape
Set Box190 = Me.Shapes("Group 190")

If Not (Intersect(Target, Range("L2:L200")) Is Nothing) Then
With Target
Shapes("Group 190").Visible = True
If Selection.Left + Selection.Width + Box190.Width Rows(1).Width
Then
Box190.Left = Selection.Left - Box190.Width
Else: Box190.Left = Selection.Left + Selection.Width
End If
If Selection.Top + Selection.Height + Box190.Height
Columns(1).Height Then
Box190.Top = Selection.Top - Box190.Height
Else: Box190.Top = Selection.Top + Selection.Height
End If
Box190.ZOrder msoBringToFront
End With
Else: Shapes("Group 190").Visible = False
End If

The problem is that the autoshape keeps changing sizes, I assume as a result
of other copy/paste/clear actions taken at different times. I have tried
setting the format of each autoshape (including the original shape, the
picture added, and the group) to all variations possible...don't move/size,
etc. When the other macros are run to copy/paste/clear, I set
application.enableevents to false. I can't figure out why the size of the
shapes keeps changing, and was wondering if it had something to do with the
above code .

Am really really frustrated with this and was hoping someone out there could
help me.....thanks so much.....

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 270
Default AutoShape Re-Sizing IS KILLING ME!!!!

Hi, Jim. It is currently, 'Don't move or size with cells'. I've tried all 3
options at various times, and still have the problem.

"Jim Thomlinson" wrote:

Just a guess but right click on the shape and go to Format - Properties.
What is the option selected in terms of moving and sizing?
--
HTH...

Jim Thomlinson


"Paige" wrote:

I have added an autoshape, then copied an Excel table over to it, and grouped
them together. In VB there is the following code, that brings up the
autoshape whenever someone clicks on a cell in the range of L2:L200, and
anchors the shape to that cell:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Box190 As Shape
Set Box190 = Me.Shapes("Group 190")

If Not (Intersect(Target, Range("L2:L200")) Is Nothing) Then
With Target
Shapes("Group 190").Visible = True
If Selection.Left + Selection.Width + Box190.Width Rows(1).Width
Then
Box190.Left = Selection.Left - Box190.Width
Else: Box190.Left = Selection.Left + Selection.Width
End If
If Selection.Top + Selection.Height + Box190.Height
Columns(1).Height Then
Box190.Top = Selection.Top - Box190.Height
Else: Box190.Top = Selection.Top + Selection.Height
End If
Box190.ZOrder msoBringToFront
End With
Else: Shapes("Group 190").Visible = False
End If

The problem is that the autoshape keeps changing sizes, I assume as a result
of other copy/paste/clear actions taken at different times. I have tried
setting the format of each autoshape (including the original shape, the
picture added, and the group) to all variations possible...don't move/size,
etc. When the other macros are run to copy/paste/clear, I set
application.enableevents to false. I can't figure out why the size of the
shapes keeps changing, and was wondering if it had something to do with the
above code .

Am really really frustrated with this and was hoping someone out there could
help me.....thanks so much.....

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default AutoShape Re-Sizing IS KILLING ME!!!!

Sorry I did not read you first post carefully enough. The setting you have
(Don't Move or Size) is the correct setting. I just tried your code (which is
generally very good) and it worked flawlessly. I tweaked a couple of things
but nothing that should materially effect the way it runs.

Here is what I came up with. Give it a try but I don 't hold out a lot of
hope that it will fix your problem, since as I said it worked great for me
without any modifications.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Box190 As Shape
Set Box190 = Me.Shapes("Group 190")

If Not (Intersect(Target, Range("L2:L200")) Is Nothing) Then
With Target
Shapes("Group 190").Visible = True
If .Left + .Width + Box190.Width Rows(1).Width Then
Box190.Left = .Left - Box190.Width
Else
Box190.Left = .Left + .Width
End If
If .Top + .Height + Box190.Height Columns(1).Height Then
Box190.Top = .Top - Box190.Height
Else
Box190.Top = .Top + .Height
End If
Box190.ZOrder msoBringToFront
End With
Else
Box190.Visible = False
End If

End Sub
--
HTH...

Jim Thomlinson


"Paige" wrote:

Hi, Jim. It is currently, 'Don't move or size with cells'. I've tried all 3
options at various times, and still have the problem.

"Jim Thomlinson" wrote:

Just a guess but right click on the shape and go to Format - Properties.
What is the option selected in terms of moving and sizing?
--
HTH...

Jim Thomlinson


"Paige" wrote:

I have added an autoshape, then copied an Excel table over to it, and grouped
them together. In VB there is the following code, that brings up the
autoshape whenever someone clicks on a cell in the range of L2:L200, and
anchors the shape to that cell:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Box190 As Shape
Set Box190 = Me.Shapes("Group 190")

If Not (Intersect(Target, Range("L2:L200")) Is Nothing) Then
With Target
Shapes("Group 190").Visible = True
If Selection.Left + Selection.Width + Box190.Width Rows(1).Width
Then
Box190.Left = Selection.Left - Box190.Width
Else: Box190.Left = Selection.Left + Selection.Width
End If
If Selection.Top + Selection.Height + Box190.Height
Columns(1).Height Then
Box190.Top = Selection.Top - Box190.Height
Else: Box190.Top = Selection.Top + Selection.Height
End If
Box190.ZOrder msoBringToFront
End With
Else: Shapes("Group 190").Visible = False
End If

The problem is that the autoshape keeps changing sizes, I assume as a result
of other copy/paste/clear actions taken at different times. I have tried
setting the format of each autoshape (including the original shape, the
picture added, and the group) to all variations possible...don't move/size,
etc. When the other macros are run to copy/paste/clear, I set
application.enableevents to false. I can't figure out why the size of the
shapes keeps changing, and was wondering if it had something to do with the
above code .

Am really really frustrated with this and was hoping someone out there could
help me.....thanks so much.....

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 270
Default AutoShape Re-Sizing IS KILLING ME!!!!

Thanks, Jim. I'm ready to try anything, including hari-kari.

"Jim Thomlinson" wrote:

Sorry I did not read you first post carefully enough. The setting you have
(Don't Move or Size) is the correct setting. I just tried your code (which is
generally very good) and it worked flawlessly. I tweaked a couple of things
but nothing that should materially effect the way it runs.

Here is what I came up with. Give it a try but I don 't hold out a lot of
hope that it will fix your problem, since as I said it worked great for me
without any modifications.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Box190 As Shape
Set Box190 = Me.Shapes("Group 190")

If Not (Intersect(Target, Range("L2:L200")) Is Nothing) Then
With Target
Shapes("Group 190").Visible = True
If .Left + .Width + Box190.Width Rows(1).Width Then
Box190.Left = .Left - Box190.Width
Else
Box190.Left = .Left + .Width
End If
If .Top + .Height + Box190.Height Columns(1).Height Then
Box190.Top = .Top - Box190.Height
Else
Box190.Top = .Top + .Height
End If
Box190.ZOrder msoBringToFront
End With
Else
Box190.Visible = False
End If

End Sub
--
HTH...

Jim Thomlinson


"Paige" wrote:

Hi, Jim. It is currently, 'Don't move or size with cells'. I've tried all 3
options at various times, and still have the problem.

"Jim Thomlinson" wrote:

Just a guess but right click on the shape and go to Format - Properties.
What is the option selected in terms of moving and sizing?
--
HTH...

Jim Thomlinson


"Paige" wrote:

I have added an autoshape, then copied an Excel table over to it, and grouped
them together. In VB there is the following code, that brings up the
autoshape whenever someone clicks on a cell in the range of L2:L200, and
anchors the shape to that cell:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Box190 As Shape
Set Box190 = Me.Shapes("Group 190")

If Not (Intersect(Target, Range("L2:L200")) Is Nothing) Then
With Target
Shapes("Group 190").Visible = True
If Selection.Left + Selection.Width + Box190.Width Rows(1).Width
Then
Box190.Left = Selection.Left - Box190.Width
Else: Box190.Left = Selection.Left + Selection.Width
End If
If Selection.Top + Selection.Height + Box190.Height
Columns(1).Height Then
Box190.Top = Selection.Top - Box190.Height
Else: Box190.Top = Selection.Top + Selection.Height
End If
Box190.ZOrder msoBringToFront
End With
Else: Shapes("Group 190").Visible = False
End If

The problem is that the autoshape keeps changing sizes, I assume as a result
of other copy/paste/clear actions taken at different times. I have tried
setting the format of each autoshape (including the original shape, the
picture added, and the group) to all variations possible...don't move/size,
etc. When the other macros are run to copy/paste/clear, I set
application.enableevents to false. I can't figure out why the size of the
shapes keeps changing, and was wondering if it had something to do with the
above code .

Am really really frustrated with this and was hoping someone out there could
help me.....thanks so much.....



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
killing accents sos Philippe Excel Programming 2 December 23rd 05 08:06 AM
VBA loop is killing me! Dave Bailey Excel Discussion (Misc queries) 1 October 14th 05 07:43 AM
help me out with this - it's killing me.. popovsky[_8_] Excel Programming 6 July 22nd 05 09:20 AM
killing a sub from within an if statement Cliff L Excel Programming 8 May 11th 05 02:04 PM
Killing Excel :) Nicolas Mainczyk Excel Programming 1 October 8th 03 03:57 PM


All times are GMT +1. The time now is 12:50 PM.

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"