View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Clear UsedRange except specific cells?

Sub clearexcept()
Set rp = Range("A4:C4")
For Each r In ActiveSheet.UsedRange
If Intersect(r, rp) Is Nothing Then
r.Clear
End If
Next
End Sub

--
Gary''s Student - gsnu200735


"Ray" wrote:

I have some code which currently loops through my worksheets (30+) and
'values out' the UsedRange (approx A1:Z50). I'd like to use a
hyperlink in cells A4:C4 (merged cells) to let users navigate back to
a Summary page. However, my code wipes out that formula ...

If there a way to exclude these cells (A4:C4) from the code to value
out the UsedRange?

rgds, ray