#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 78
Default macro

I am very new at macros. I would to create one that would after sorting a
table delete automatically the whole row if a specific cell from that row
contain a specific value. For example if I sort my table by column C: who is
enrolled, waiting for enrolment, pass to centre, rejected by centre. I want
then my macro to select all the "rejected by centre" and delete these rows.
Is it possible?
Many thanks

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default macro


You can do this without sorting by a looping macro such as
sub deletebadrows()
for i=cells(rows.count,"a").end(xlup).row to 2 step -1
if ucase(cells(i,"c"))="REJECTED BY CENTRE" then rows(i).delete
next i

or if you sort and the bad rows are at the bottom use FIND and delete all
rows below.
Other ways.
--
Don Guillett
SalesAid Software

"Pascale" wrote in message
...
I am very new at macros. I would to create one that would after sorting a
table delete automatically the whole row if a specific cell from that row
contain a specific value. For example if I sort my table by column C: who
is
enrolled, waiting for enrolment, pass to centre, rejected by centre. I
want
then my macro to select all the "rejected by centre" and delete these
rows.
Is it possible?
Many thanks



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default macro

Sub delete_rows()
Dim c As Range
With Columns("C")
Do
Set c = .Find("rejected by centre", LookIn:=xlValues, _
LookAt:=xlWhole, MatchCase:=False)
If c Is Nothing Then Exit Do
c.EntireRow.Delete
Loop
End With
End Sub


Gord Dibben MS Excel MVP

On Mon, 12 Mar 2007 10:16:31 -0700, Pascale
wrote:

I am very new at macros. I would to create one that would after sorting a
table delete automatically the whole row if a specific cell from that row
contain a specific value. For example if I sort my table by column C: who is
enrolled, waiting for enrolment, pass to centre, rejected by centre. I want
then my macro to select all the "rejected by centre" and delete these rows.
Is it possible?
Many thanks


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
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 1 February 5th 07 10:31 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 3 February 5th 07 09:22 PM
using a cell value to control a counter inside a macro and displaying macro value ocset Excel Worksheet Functions 1 September 10th 06 06:32 AM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 1 June 11th 05 01:44 AM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 0 June 10th 05 04:38 PM


All times are GMT +1. The time now is 06:56 PM.

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"