Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default search for cell and clear contents

I am working with a macro and I am in the final stages. I need to clean up
the excel file by deleting all the rows/columns not needed. What I am looking
for is a formula I can add to my macro that searches column A for the first
cell that contains 8 blank spaces " ", when it finds this cell, I
would like the formula to delete that entire row and everything beneath this
row. Something like:
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default search for cell and clear contents

Mike wrote:
I am working with a macro and I am in the final stages. I need to clean up
the excel file by deleting all the rows/columns not needed. What I am looking
for is a formula I can add to my macro that searches column A for the first
cell that contains 8 blank spaces " ", when it finds this cell, I
would like the formula to delete that entire row and everything beneath this
row. Something like:
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents


Try this:

Range("A:A").Find(What:=" ", LookIn:=xlValues).Activate
ActiveCell.Resize(ActiveCell.End(xlDown)).EntireRo w.Delete

HTH, CoRrRan
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 do I clear a cell contents but not the formula behind it SliderSteve Excel Discussion (Misc queries) 5 November 19th 07 11:33 PM
Macro to clear range contents when cell contents are changed by us Steve E Excel Programming 12 February 22nd 07 09:09 PM
Clear Cell Contents workerboy[_4_] Excel Programming 2 August 10th 06 06:29 PM
VBA Clear Cell Contents towl[_3_] Excel Programming 4 October 20th 05 05:14 PM
vb to clear cell contents RichT New Users to Excel 6 June 27th 05 08:26 AM


All times are GMT +1. The time now is 09:16 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"