delete highlighted rows
The UK's Number 1 for Microsoft Office Training Add this page to your favourites/bookmarksBookmark page
 
View printable version of pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

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

Delete highlighted rows

resolvedResolved · Urgent Priority · Version 2010

replyReply Fri 15 Apr 2011, 10:46Delegate Tashi said...

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.

For upcoming training course dates see: Pricing & availability

replyReply Mon 18 Apr 2011, 10:11Trainer Mark said...

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

replyReply Wed 20 Apr 2011, 14:48Trainer Simon said...

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.

 

Please browse our web site to find out more about
excel classes and other Microsoft training courses.

Excel tip:

Make macros work in newer versions of Excel

If you have created macros in Excel 97 or 2000 that you want to be able to use in 2002/XP or 2003, you may need to alter the macro security settings in the newer version of Excel you are using.

To do this, go to Tools - Options - Security.

Select Macro Security and change the security setting to Low.

Tick the boxes next to 'Trust Add-ins' and 'Trust Visual Basic' and click OK.

After you have restarted Windows, you should then be able to use your macros created in earlier versions of Excel.

View all Excel hints and tips


Microsoft Certified Partner Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses Security Seal verified by visa, mastercard securecard