PC Review


Reply
Thread Tools Rate Thread

Define a range of rows having the same value in one column

 
 
gimme_this_gimme_that@yahoo.com
Guest
Posts: n/a
 
      6th Oct 2006
Right now I'm looping through the sorted column and marking the
beginning row and end row of a column having a specific value and
selecting that.

But does Excel have a mechanism that does this for you?

Or perhaps, instead of selecting the rows, selects all the values in
one column having a specific value?

Even better yet would be a solution where the rows can then be deleted.

Thanks.

 
Reply With Quote
 
 
 
 
Don Guillett
Guest
Posts: n/a
 
      6th Oct 2006
how about sorting or data>filter>autofilter>

--
Don Guillett
SalesAid Software
(E-Mail Removed)
<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Right now I'm looping through the sorted column and marking the
> beginning row and end row of a column having a specific value and
> selecting that.
>
> But does Excel have a mechanism that does this for you?
>
> Or perhaps, instead of selecting the rows, selects all the values in
> one column having a specific value?
>
> Even better yet would be a solution where the rows can then be deleted.
>
> Thanks.
>



 
Reply With Quote
 
Will Cairns
Guest
Posts: n/a
 
      6th Oct 2006

(E-Mail Removed) wrote:
> Right now I'm looping through the sorted column and marking the
> beginning row and end row of a column having a specific value and
> selecting that.
>
> But does Excel have a mechanism that does this for you?
>
> Or perhaps, instead of selecting the rows, selects all the values in
> one column having a specific value?
>
> Even better yet would be a solution where the rows can then be deleted.
>
> Thanks.


I've used this method before..

' ------first find the value your looking for in column 'a'
ActiveSheet.Cells.Find(MyString, LookIn:=xlValues, LookAt:= _
xlWhole).Select

' -----next find how many other rows have the same value
Mycount = Application.Evaluate("=COUNTIF(A:A," & ActiveCell.Address &
")")

' ------then select all rows (and adjacent columns) where the values
are the same
Range(Selection.End(xlToRight), Selection.Offset(Mycount - 1,
0)).Select

'-------delete them if thats what you want
Selection.Delete Shift:=xlUp

Will

 
Reply With Quote
 
Will Cairns
Guest
Posts: n/a
 
      6th Oct 2006

(E-Mail Removed) wrote:
> Right now I'm looping through the sorted column and marking the
> beginning row and end row of a column having a specific value and
> selecting that.
>
> But does Excel have a mechanism that does this for you?
>
> Or perhaps, instead of selecting the rows, selects all the values in
> one column having a specific value?
>
> Even better yet would be a solution where the rows can then be deleted.
>
> Thanks.


I've used this method before..

' ------first find the value your looking for in column 'a'
ActiveSheet.Cells.Find(MyString, LookIn:=xlValues, LookAt:= _
xlWhole).Select

' -----next find how many other rows have the same value
Mycount = Application.Evaluate("=COUNTIF(A:A," & ActiveCell.Address &
")")

' ------then select all rows (and adjacent columns) where the values
are the same
Range(Selection.End(xlToRight), Selection.Offset(Mycount - 1,
0)).Select

'-------delete them if thats what you want
Selection.Delete Shift:=xlUp

Will

 
Reply With Quote
 
gimme_this_gimme_that@yahoo.com
Guest
Posts: n/a
 
      6th Oct 2006
Thanks Guys.

Both tips were very helpful.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Define range by last cell in column? AUCP03 Microsoft Excel Programming 3 28th Aug 2009 07:41 PM
Define a range containing the first 10 rows of a filtered list =?Utf-8?B?TWFyY28=?= Microsoft Excel Worksheet Functions 3 7th Oct 2005 01:42 PM
How to retrieve a column number and apply it to define a range? Frank Krogh Microsoft Excel Worksheet Functions 6 9th Mar 2004 02:13 PM
Define Range in Deleting Empty Rows HamishM Microsoft Excel Programming 1 19th Dec 2003 01:17 AM
define end column in a range Chris Perry Microsoft Excel Programming 1 1st Oct 2003 08:13 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:00 PM.