View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
David Turner David Turner is offline
external usenet poster
 
Posts: 50
Default Leave last col alone

Greg Wilson wrote

Range(Cells(c.Row, 1), Cells(c.Row, 255)).ClearContents


Actually, this syntax allowed me to successfully handle another workbook
where I had to clear multiple ranges in the same row:

cols = ActiveSheet.UsedRange.Columns.Count
Set rng = Range(Cells(5, 1), Cells(Rows.Count, 1).End(xlUp).Offset(-6, 0))
For Each c In rng
If c = Old_Member Then
Range(Cells(c.Row, 1), Cells(c.Row, 2)).ClearContents
Range(Cells(c.Row, 10), Cells(c.Row, cols)).ClearContents
End If
Next c

Many thanks!

--
David