View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Maurice[_4_] Maurice[_4_] is offline
external usenet poster
 
Posts: 1
Default Help with creating CLEAR button


Another option you can try

Sub clear()
Dim Msg, Style, Title, Response, MyString, varfilestring
Msg = "Continuing will Delete all Data (i.e. Start New Week)" & Chr(13
_
& "Default values will replace" ' Define message.
Style = vbYesNo + vbDefaultButton2 ' Define buttons.
Title = "Erase Form Data" ' Define title.
Response = MsgBox(Msg, Style, Title, Help, Ctxt)
If Response = vbYes Then ' User chose Yes.
MyString = "Yes" ' Perform some action.
Range("B7:G57").Select
Selection.ClearContents
Range("I7:N57").Select
Selection.ClearContents
Range("P7:U57").Select
Selection.ClearContents
DONE
Else ' User chose No.
MyString = "No" ' Perform some action.
DONE
End If
varfilestring = "Blank_Manning_v3" & ".xls"
ActiveWorkbook.SaveAs varfilestring, FileFormat:=xlNormal
password:="", WriteResPassword:="", ReadOnlyRecommended:=False
CreateBackup:=True
End Sub

Will need modification for what you actually want. This way you a
least get the chance not to run the macro should you trigger i
accidental

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com