VinceF
Board Regular
- Joined
- Sep 22, 2007
- Messages
- 172
- Office Version
- 2016
- Platform
- Windows
Two problems please.
Novice user (thankful for this forum and Google)
Problem 1. When the sheet is locked the VBA code to reset the sheet doesn't clear the cells as designed. If the sheet is unlocked, it works fine.
Problem 2. When resetting the sheet with VBA I keep getting a Runtime Error 1004, no cells found. It mostly points towards this line
Sheets("main").Range("e12:g51").SpecialCells(xlConstants).ClearContents
Thank you in advance for your assistance.
VinceF
Win 10
Excel 2016
Novice user (thankful for this forum and Google)
Problem 1. When the sheet is locked the VBA code to reset the sheet doesn't clear the cells as designed. If the sheet is unlocked, it works fine.
Problem 2. When resetting the sheet with VBA I keep getting a Runtime Error 1004, no cells found. It mostly points towards this line
Sheets("main").Range("e12:g51").SpecialCells(xlConstants).ClearContents
Thank you in advance for your assistance.
VinceF
Win 10
Excel 2016
VBA Code:
rivate Sub CommandButton1_Click()
Dim warning
warning = MsgBox(Range("A1").Value & " WARNING !!!! WARNING !!! WARNING !!! This will reset the entire sheet. Select OK to continue or select CANCEL to continue without resetting", vbOKCancel, "Warning")
If warning = vbCancel Then Exit Sub
Sheets("main").Range("q4").Value = "SELECT COURSE"
Sheets("main").Range("I4").Value = "SELECT TEE"
Sheets("main").Range("W4").Value = "PLAYING CONDITIONS"
Sheets("main").Range("AC4").Value = "BUNKER RELIEF"
Sheets("main").Range("B4").Value = "GAME TYPE"
Sheets("main").Range("E4").Value = "SKINS FEE"
Sheets("main").Range("B7").Value = ""
Sheets("main").Range("F4").Value = "STABLEFORD FEE"
Sheets("main").Range("AG4").Value = "POINT/PLACE"
Sheets("main").Range("D51").Value = ""
Sheets("main").Range("AE51").Value = ""
Sheets("main").Range("ag7:aj7").Value = ""
Sheets("main").Range("B12:d51").Value = ""
Sheets("main").Range("i12:r51").Value = ""
Sheets("main").Range("t12:ab51").Value = ""
Sheets("main").Range("e12:g51").SpecialCells(xlConstants).ClearContents
Sheets("main").Range("AG12:AK51").SpecialCells(xlConstants).ClearContents
Sheets("main").Range("I12:AE51").SpecialCells(xlConstants).ClearContents
Sheets("main").Range("I12:r12").SpecialCells(xlConstants).ClearContents
Sheets("main").Range("I13:r13").SpecialCells(xlConstants).ClearContents
Sheets("main").Range("AH4").SpecialCells(xlConstants).ClearContents
Sheets("main").Range("AI4").SpecialCells(xlConstants).ClearContents
Sheets("main").Range("AJ4").SpecialCells(xlConstants).ClearContents
MsgBox "THE FORM HAS BEEN RESET."
End Sub
Last edited by a moderator: