Excel.Tips.Net ExcelTips (Menu Interface)

Moving Cell Borders when Sorting

Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Moving Cell Borders when Sorting.

Frank has a simple two-column table that contains random dates in the first column and the letters A through E in the second column. He formats the cell containing the letter C so it has a background color and a border around the cell. When Frank sorts the table according to what is in the first column, Excel moves the background color with the C cell, but it doesn't move the border. Frank wonders if there is a way to move both the color and border of a cell when sorting.

The solution is to change how you are doing your formatting. Excel provides two types of formatting that can be applied to cells—regular formatting and conditional formatting. If you apply regular formatting, then what moves when you sort can seem rather arbitrary. If you apply conditional formatting, then all the formatting applied by the condition (or conditions) will move with the cell when you sort.

So the answer to the question is to change how you do your formatting in this instance. Just apply a conditional format that modifies the border of the cell, and then you can sort in peace. (The condition you set could easily be one that is always True, and thus the formatting always applied.)

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (8881) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Moving Cell Borders when Sorting.

Related Tips:

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!


Leave your own comment:

  Notify me about new comments ONLY FOR THIS TIP
Notify me about new comments ANYWHERE ON THIS SITE
Hide my email address
*What is 5+3 (To prevent automated submissions and spam.)
           Commenting Terms

Comments for this tip:

Rob    27 Sep 2016, 08:45
Hi, I have followed the instructions for tip 8881 i.e.
Conditional format
New rule
"Use formula to determine which cells to format" and select range (=$A$1<>$H$1)
Format for outside border and save

The borders appear but when I do a sort the borders disappear. What am I doing wrong? Can you assist please? I have had a look through your excel tips but cannot find anything to help.
allen@sharonparq.com    01 Sep 2016, 22:17
James: Yes, that capability is now gone and has been for almost a decade. Sorry!

James LaValley    01 Sep 2016, 14:57

I remember back in the day when you could add animated borders around words in Word. Either flashing or ants running around the word. Is that still possible today...and is it possible in Excel? I want to do it in a spreadsheet I am sending electronically so the recipient will see the animation and cannot figure out how to do it. So I went to Word and I don't see it there anymore. Any thoughts?

Dawn    21 Jul 2015, 05:50
This does not tell me how to do it once I have selected Conditional Formatting

Our Company

Sharon Parq Associates, Inc.

About Tips.Net

Contact Us


Advertise with Us

Our Privacy Policy

Our Sites


Beauty and Style




DriveTips (Google Drive)

ExcelTips (Excel 97–2003)

ExcelTips (Excel 2007–2016)



Home Improvement

Money and Finances


Pests and Bugs

Pets and Animals

WindowsTips (Microsoft Windows)

WordTips (Word 97–2003)

WordTips (Word 2007–2016)

Our Products

Helpful E-books

Newsletter Archives


Excel Products

Word Products

Our Authors

Author Index

Write for Tips.Net

Copyright © 2016 Sharon Parq Associates, Inc.