How to clear a selection

  • Thread starter Thread starter Nathan Gutman
  • Start date Start date
N

Nathan Gutman

I need to determine the last cell with data in column A then clear
contents from the last three cells in that column.
What is a simple way to do that?
Thanks..
 
Hi Nathan

Try this

Sub test()
Dim Lr As Long
With Sheets("sheet1")
Lr = .Range("A" & Rows.Count).End(xlUp).Row
..Range(.Cells(Lr - 2, "A"), .Cells(Lr, "A")).ClearContents
End With
End Sub
 
Good Evening Nathan,

A simple one-liner

Worksheets("Sheet2").Cells(Rows.Count, "A").End(xlUp).Offset(-2,
0).Resize(3, 1).ClearContents

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Hello Bob,
You one-liner worked beautifully! In my case I just used
ActiveSheet.Cells(...
Would you care to explain what is doing what here.
Thanks again,
Nathan
 
Back
Top