98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft Excel Training and help » Delete highlighted rows
Delete highlighted rows
Resolved · 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.
Training information:
See also:
Welcome. Please choose your application (eg. Excel) and then post your question. Our Microsoft Qualified trainers will then respond within 24 hours (working days). Frequently Asked Questions
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
Excel tip:Moving between Worksheets without using the mouseUse the 'Ctrl+PgDn' and 'Ctrl+PgUp' keys. |