Moving shapes is driving me potty

F

Francis Hookam

Please help - I've just spent another hour trying to fathom out Windows
windows as opposed to Mac windows work - I know I ought to address this to
the PC group but Mac users are more likely to come across this problem
posted yesterday

Any idea why the following toggles back and forth nicely on Mac XL 2001 and
not on PC XL 2000

On the PC the shape moves once to the 100x100 position and then does not
budge - it is the same file on two different machines!

Is there a better way - I was trying to avoid actually selecting the group
and then clicking elsewhere after the move to de-select the group (that does
not work anyway on PC)

(The shape is a group of buttons, one of which is this toggle. It is helpful
to be able to move the group out of the way and later bring them back. It
seems better to have a recognisable button do this than for an unwary user
trying grab the group and drag it out of the way)

Sub MoveButtons()
If ActiveSheet.Shapes("ButtonGroup").Top = 100 Then
With ActiveSheet.Shapes("ButtonGroup")
.Top = 40
.Left = 40
End With
Else
With ActiveSheet.Shapes("ButtonGroup")
.Top = 100
.Left = 100
End With
End If
End Sub

Many thanks

Francis Hookham
 
J

JE McGimpsey

Francis Hookam said:
Please help - I've just spent another hour trying to fathom out Windows
windows as opposed to Mac windows work - I know I ought to address this to
the PC group but Mac users are more likely to come across this problem
posted yesterday

Any idea why the following toggles back and forth nicely on Mac XL 2001 and
not on PC XL 2000

On the PC the shape moves once to the 100x100 position and then does not
budge - it is the same file on two different machines!

Check out the .top position in WinXL. When I try it in XL03:

ActiveSheet.Shapes("ButtonGroup").Top = 100
?ActiveSheet.Shapes("ButtonGroup").Top
99.75

Try:

Public Sub MoveButtons()
With ActiveSheet.Shapes("ButtonGroup")
If Abs(.Top - 100) < 1 Then
.Top = 40
.Left = 40
Else
.Top = 100
.Left = 100
End If
End With
End Sub

Or, more compactly:

Public Sub MoveButtons()
With ActiveSheet.Shapes("ButtonGroup")
.Top = 100 + 60 * (.Top > 90)
.Left = .Top
End With
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top