I'm new to this and I'm trying to clear cells on multiple sheets that some cells have formulas and it works fine unless there is a sheet that has nothing in the cells that were selected, it then gives me the following error. Please help! Thanks!
Run-time Error '1004":
No cells were found
On debug the highlighted line is on the sheet that did not have any information, see sheet "E" the line of code
. This is what my code looks like. By the way I have sheets that run thru "U".
Run-time Error '1004":
No cells were found
On debug the highlighted line is on the sheet that did not have any information, see sheet "E" the line of code
VBA Code:
Selection.SpecialCells(xlCellTypeConstants, 23).Select
VBA Code:
Sub ClearTimeContents()
'
' ClearTimeContents Macro
'
Sheets("Time").Select
ActiveSheet.Unprotect
Range("D5:U1764").Select
Selection.SpecialCells(xlCellTypeConstants, 23).Select
Selection.ClearContents
ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
False
Range("D5").Select
Sheets("D").Select
ActiveSheet.Unprotect
Range("C35:C494").Select
Selection.SpecialCells(xlCellTypeConstants, 23).Select
Selection.ClearContents
ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
False
Range("C35").Select
Sheets("E").Select
ActiveSheet.Unprotect
Range("C35:C494").Select
Selection.SpecialCells(xlCellTypeConstants, 23).Select
Selection.ClearContents
ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
False
Range("C35").Select