ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   MsgBox (https://www.excelbanter.com/excel-programming/271207-msgbox.html)

Phil Perry

MsgBox
 
Thanks to everyone helping with moving the text box. The
code is
Sub moveit()
MsgBox "Clear Data?", vbQuestion + vbYesNo
ActiveSheet.Shapes("Text Box 1").Select
Selection.Characters.Text = " object to move"
Selection.Top = Sheet1.Range("B2").Top
Selection.Left = Sheet1.Range("B2").Left
Range("A1").Select
End Sub

With regard to the message box, if someone clicks on NO
to clear data, how do I get them to return to Sheet 1
without activating the next lot of code?
Thanks in anticipation.

Dan E[_2_]

MsgBox
 
Sub moveit()
MsgAns = MsgBox("Clear Data?", vbQuestion + vbYesNo)
If MsgAns = vbYes Then
ActiveSheet.Shapes("Text Box 1").Select
Selection.Characters.Text = " object to move"
Selection.Top = Sheet1.Range("B2").Top
Selection.Left = Sheet1.Range("B2").Left
Range("A1").Select
End If
End Sub

Dan E

"Phil Perry" wrote in message
...
Thanks to everyone helping with moving the text box. The
code is
Sub moveit()
MsgBox "Clear Data?", vbQuestion + vbYesNo
ActiveSheet.Shapes("Text Box 1").Select
Selection.Characters.Text = " object to move"
Selection.Top = Sheet1.Range("B2").Top
Selection.Left = Sheet1.Range("B2").Left
Range("A1").Select
End Sub

With regard to the message box, if someone clicks on NO
to clear data, how do I get them to return to Sheet 1
without activating the next lot of code?
Thanks in anticipation.





All times are GMT +1. The time now is 12:47 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com