PC Review


Reply
Thread Tools Rate Thread

Delete entire row based on cell color

 
 
=?Utf-8?B?Q01jSw==?=
Guest
Posts: n/a
 
      27th Oct 2006
Hello,

Could someone show me how to develop a macro that would delete an entire row
depending on the font color (ie: red) of text in column A.

Many thanks.

CMcK
 
Reply With Quote
 
 
 
 
John Coleman
Guest
Posts: n/a
 
      27th Oct 2006
This deletes row 5 if the font in column 1 (A) is red:

Sub test()
If Columns(1).Font.ColorIndex = 3 Then Rows(5).Delete
End Sub

HTH

-John Coleman

CMcK wrote:
> Hello,
>
> Could someone show me how to develop a macro that would delete an entire row
> depending on the font color (ie: red) of text in column A.
>
> Many thanks.
>
> CMcK


 
Reply With Quote
 
=?Utf-8?B?Q01jSw==?=
Guest
Posts: n/a
 
      27th Oct 2006
Thanks John. When I look at the line of code it looks extremely
straightforward. I just have difficulty putting together the correct syntax.
Your help is really appreciated - thanks again.

CMcK

"John Coleman" wrote:

> This deletes row 5 if the font in column 1 (A) is red:
>
> Sub test()
> If Columns(1).Font.ColorIndex = 3 Then Rows(5).Delete
> End Sub
>
> HTH
>
> -John Coleman
>
> CMcK wrote:
> > Hello,
> >
> > Could someone show me how to develop a macro that would delete an entire row
> > depending on the font color (ie: red) of text in column A.
> >
> > Many thanks.
> >
> > CMcK

>
>

 
Reply With Quote
 
John Coleman
Guest
Posts: n/a
 
      27th Oct 2006
You're welcome - I didn't completely know the answer until I decided to
reply. I turned on the macro recorder, colored the font in A red and
then deleted a row. I then turned off the macro recorder and looked at
the code. I also double-checked on the help system that you could
replace Columns("A:A") by Columns(1) (which looks slightly better in my
opinion - but you might want to leave it as Columns("A:A"). It's best
to know about both usages, since it might be a hassle to figure out the
column number of column BF for example)
In any event - a combination of the macro recorder and help (and
google) can clear up most questions about syntax. Just remember to
avoid all the selections that the macro recorder records and replact
them by direct references to the relevant objects.

HTH

-John Coleman

CMcK wrote:
> Thanks John. When I look at the line of code it looks extremely
> straightforward. I just have difficulty putting together the correct syntax.
> Your help is really appreciated - thanks again.
>
> CMcK
>
> "John Coleman" wrote:
>
> > This deletes row 5 if the font in column 1 (A) is red:
> >
> > Sub test()
> > If Columns(1).Font.ColorIndex = 3 Then Rows(5).Delete
> > End Sub
> >
> > HTH
> >
> > -John Coleman
> >
> > CMcK wrote:
> > > Hello,
> > >
> > > Could someone show me how to develop a macro that would delete an entire row
> > > depending on the font color (ie: red) of text in column A.
> > >
> > > Many thanks.
> > >
> > > CMcK

> >
> >


 
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
Specify a row based on data from a cell to delete entire row..... Fadedmartinikiss Microsoft Excel Misc 0 11th Mar 2009 08:39 PM
Hide/Delete entire rows based in the content of one cell =?Utf-8?B?Q2x1ZWxlc3M=?= Microsoft Excel Misc 2 3rd Oct 2005 02:40 PM
Color the entire row based on the value in one column in WinForms's Datagrid David Krmpotic Microsoft C# .NET 4 27th Feb 2005 04:19 PM
Macro to delete entire row based on empty cell =?Utf-8?B?QUw=?= Microsoft Excel Programming 1 19th Mar 2004 01:58 AM
Delete entire row based on cell content PHIL Microsoft Excel Programming 2 3rd Dec 2003 01:39 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:29 PM.