delete highlighted rows

Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

Forum home » Delegate support and help forum » Microsoft Excel Training and help » Delete highlighted rows

Delete highlighted rows

resolvedResolved · Urgent Priority · Version 2010

Tashi has attended:
No courses

Delete highlighted rows

I have a spreadsheet with half the rows highlighted in yellow. I want to delete the rows with the background highlighted in yellow and keep the rows with "no fill" or no highlighting. How do I do this?

On the same topic, after I have conditionally formatted and so highlighted some cell values (e.g. if over 500), how do I delete all the highlighted cells or replace them with 0?

Thank you for your help.

RE: Delete highlighted rows

Hello Tashi,

Thank you for your question regarding conditional deleting of rows.
This could be achieved through VBA code. The following code will delete any rows that are coloured standard yellow. You may be able to adapt this to suit your needs. You can specify any colour by using the RGB value instead of the standard vbyellow Ive used here for demonstration purposes.

You could easily alter this code to achieve the answer to your second question.

sample code:

Sub DeleteRows()
Range("A1").Select

Do Until ActiveCell = ""
If ActiveCell.Interior.Color = vbYellow Then
ActiveCell.Rows.Delete
Else
ActiveCell.Offset(1, 0).Select
End If
Loop

End Sub


I hope this resolves your question. If it has, please mark this question as resolved.

If you require further assistance, please reply to this post. Or perhaps you have another Microsoft Office question?

Have a great day.
Regards,

Mark
Microsoft Office Specialist Trainer

Will be marked as resolved in 5 days

Notice: This is an automated message. Due to inactivity, this forum post will be marked as 'resolved' if there are no further responses in the next 5 days.

Wed 27 Apr 2011: Automatically marked as resolved.


 

Excel tip:

Moving between Worksheets without using the mouse

Use the 'Ctrl+PgDn' and 'Ctrl+PgUp' keys.

'Ctrl+PgDn' will move to the right and 'Ctrl+PgUp' will move to the left one worksheet at a time.

View all Excel hints and tips


Server loaded in 0.1 secs.