Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Selecting rows based on a value

Jeff,

You have to do it the other way around and select rows that don't relate to
A and then delete.

Right click your sheet tab, view code and paste this in and run it. Because
it deletes data try it on a test workbook.

Sub Marine()
Dim MyRange As Range, copyrange As Range
Lastrow = Cells(Cells.Rows.Count, "A").End(xlUp).Row
Set MyRange = Range("A1:A" & Lastrow)
For Each c In MyRange
If ucase(c.Value) < "A" Then
If copyrange Is Nothing Then
Set copyrange = c.EntireRow
Else
Set copyrange = Union(copyrange, c.EntireRow)
End If
End If
Next
If Not copyrange Is Nothing Then
copyrange.Delete
End If
End Sub

Mike

"Jeff Parrott" wrote:

I have a large spreadsheet that I need to sort on a daily basis. I have
several macros that I use to sot and delete rows but I can't figure out how
to do one thing.

The rows all contain data based on warehouse locations. The first column of
the sheet lists all of the warehouses based on letter designations (A,B,C...)
I want to select the rows containing data related to warehouse "A" and delete
everything else. Any suggestions?

--
Whether you think you can or cannot, you're right. - Henry Ford

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
Selecting A Column based on Cell Value newguy Excel Discussion (Misc queries) 0 December 14th 06 09:39 PM
after selecting 50 rows of a column i can't reference the cells in the rows Bob Salzer New Users to Excel 2 July 21st 06 10:29 PM
Selecting rows based on criteria JCP Excel Discussion (Misc queries) 3 April 5th 06 09:26 AM
Selecting rows based on cell entries m.cain Excel Worksheet Functions 3 March 24th 06 04:56 PM
Selecting rows based on cell entries m.cain Excel Discussion (Misc queries) 2 March 24th 06 10:46 AM


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