Try this:
Option Explicit
Sub reset()
Dim answer As Integer
answer = MsgBox("Are You Sure You Wish To Reset All Data?", vbYesNo + vbQuestion, "MONDAY")
If answer = vbYes Then
Dim ws As Worksheet
Set ws = Sheets("MONDAY")
ws.Range("M2:P21").Value = 1
ws.Range("M25:P44").Value = 1
ws.Range("M48:P67").Value = 1
ws.Range("M71:P90").Value = 1
ws.Range("M94:P113").Value = 1
Else
Exit Sub
End If
End Sub
How to install your new code
- Copy the Excel VBA code
- Select the workbook in which you want to store the Excel VBA code
- Press Alt+F11 to open the Visual Basic Editor
- Choose Insert > Module
- Edit > Paste the macro into the module that appeared
- Close the VBEditor
- Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)
To run the Excel VBA code:- Press Alt-F8 to open the macro list
- Select a macro in the list
- Click the Run button
Bookmarks