Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default How to clear a selection

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..
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default How to clear a selection

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


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Nathan Gutman" wrote in message ...
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..



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default How to clear a selection

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)

"Nathan Gutman" wrote in message
...
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..



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default How to clear a selection

Thank you guys.
On Wed, 25 Feb 2004 20:34:52 -0000, "Bob Phillips"
wrote:

Good Evening Nathan,

A simple one-liner

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


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default How to clear a selection

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
On Wed, 25 Feb 2004 20:34:52 -0000, "Bob Phillips"
wrote:

Good Evening Nathan,

A simple one-liner

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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How To Clear Previous Selection From a Drop Down The Griffster Excel Discussion (Misc queries) 3 September 22nd 10 09:36 PM
Transfer a name from one cell to another but leave clear if clear? Scoober Excel Worksheet Functions 3 May 22nd 09 02:55 AM
clear the clear the web page email attachment lines MCrider Excel Discussion (Misc queries) 0 November 11th 07 10:05 PM
Copy Selection - Transpose Selection - Delete Selection Uninvisible Excel Discussion (Misc queries) 2 October 23rd 07 04:18 PM
How do I clear a print area when the selection is grayed out? Ron Excel Discussion (Misc queries) 0 July 24th 07 11:28 PM


All times are GMT +1. The time now is 09:42 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"