Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 1
Default Please Help! Delete all cells in range except "1934 - 1934"

I've been driving myself crazy trying to figure this out! I have a spreadsheet with a huge range of garbage cells, and I just need to extract the cells in a specific date format. IE: 1991 - 1995. A string of 11 characters (including spaces).

I am looking to delete all cells that do not fit that format and remove all blank cells.

Any help on this is greatly appeciated!

Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 151
Default Please Help! Delete all cells in range except "1934 - 1934"

Hi

Lets assume your sheet is the following:

mySht is the Name of your Sheet
myRng is the Range of the column that the code has to run down
myVal is the Date string match that you want to find in myRng
c represents every Cell within myRng

Change the above to fit the code below.

Sub RemoveGarbage()

Dim mySht As Worksheet
Dim myRng As Range
Dim myVal As Range
Dim c As Range

Set mySht = Sheets("Sheet1")
Set myRng = mySht.Range("F2:F10")
Set myVal = [F1]

For Each c In myRng
If Not c < myVal Then
With c
.EntireRow.Delete xlUp
End With
End If
Next c

End Sub

HTH
Mick.
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
Delete specific range of cells if containing "0" ElkySS Excel Programming 6 October 9th 06 07:28 PM
Convert 1934 minutes into 32Hour 14Minutes Excel_seek_help Excel Worksheet Functions 3 May 30th 06 06:10 PM
Multiple "Range" with "Cells" property? jopu[_2_] Excel Programming 3 November 18th 04 04:05 PM
Multiple "Range" with "Cells" property? jopu Excel Programming 2 November 18th 04 02:38 PM
Using "Cells" to write "Range("A:A,H:H").Select" Trip Ives[_2_] Excel Programming 3 June 5th 04 03:13 PM


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