View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Corey Corey is offline
external usenet poster
 
Posts: 363
Default Why does this code not work across all designated sheets now ?

The below code suppose to clear the values in the Range to = ""
But for some reason it works if i run the macro from an activeworksheet,
but it does NOT Clear the values in ALL shets(Minus the named 3 sheets).

I also had to add the (On error resume next) as i was getting a Cannot change part of a Merged Cell
error,
But with those ranges there Are NO Merged Cells????

Sub ClearTimeSheetValues()
Call Unprotect
On Error Resume Next
Dim myrange As Range
For Each sh In ThisWorkbook.Worksheets
If sh.Name < "Enter - Exit" And sh.Name < "Utilization Sheet" And sh.Name < "Leave Blank" Then
Set myrange = Range("C5:C16,F5:F16,I5:I16,L5:L16,O5:O16,R5:R16,U 5:U15")
With myrange
..Value = ""
Range("A1").Select
End With
End If
Next
Call protect
End Sub

Any ideas' to get this code working again ?

Corey....