View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
kirkm[_6_] kirkm[_6_] is offline
external usenet poster
 
Posts: 156
Default Clearing a Sheet


Hi,

I have a bit of code e.g.

Dim wk As Workbook
Set wk = ActiveWorkbook
Dim sht As Worksheet
Set sht = wk.Worksheets("Reports")

With sht
..Cells.ClearContents
End With

This clears the sheet, as required, BUT if I add this next:

With Worksheets("Reports")
Set rng =
Worksheets("Reports").Range("A1").SpecialCells(xlC ellTypeLastCell)
LastRow = rng.Row
End With

LastRow still contains the number of lines in the just cleared sheet.

Can I do something to make LastRow variable correct?

Thanks - Kirk