GomaPile
Active Member
- Joined
- Jul 24, 2006
- Messages
- 334
- Office Version
- 365
- Platform
- Windows
Hi All,
Is there anyone who knows how to move shapes or objects in excel 2016 around a spreadsheet.
The vba code below works fine, the shape moves back & forth Left to Right with Red Off | Green On. But I can't figure out how to move the shape Up & Down and keeping the Red Off | Green On as the same.
Cell A1 if the value = 1 or nothing (cool way to switch the formula Off/On).
Regards
Goma (NASA)
Is there anyone who knows how to move shapes or objects in excel 2016 around a spreadsheet.
The vba code below works fine, the shape moves back & forth Left to Right with Red Off | Green On. But I can't figure out how to move the shape Up & Down and keeping the Red Off | Green On as the same.
Cell A1 if the value = 1 or nothing (cool way to switch the formula Off/On).
Code:
Sub ADOSwitch()
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
If Range("A1").Value = "1" Then
ActiveSheet.Shapes("btnADO").IncrementLeft -47
ActiveSheet.Shapes.Range(Array("btnADO")).Select
Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = "OFF"
With Selection.ShapeRange.Fill
.Visible = msoTrue
.ForeColor.RGB = RGB(200, 0, 0)
.Transparency = 0
.Solid
Range("A1").Select
End With
Range("A1").Value = "0"
'MsgBox "off"
Else: Range("A1").Value = "1"
ActiveSheet.Shapes("btnADO").IncrementLeft 47
ActiveSheet.Shapes.Range(Array("btnADO")).Select
Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = "ON"
With Selection.ShapeRange.Fill
.Visible = msoTrue
.ForeColor.RGB = RGB(0, 176, 80)
.Transparency = 0
.Solid
Range("A1").Select
End With
'MsgBox "on"
End If
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
End Sub
Regards
Goma (NASA)