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: Copying Comments when Filtering.

Copying Comments when Filtering

Written by Allen Wyatt (last updated March 9, 2024)
This tip applies to Excel 97, 2000, 2002, and 2003


Vinod frequently uses Excel's advanced filtering tools to copy filtered data from one location to another. In some instances he would like to copy not only the cell contents but also the cell comments of the cells that meet the filtering criteria. He's not looking for a way to filter based on comments, but only to copy comments along with the cell contents when using the advanced filtering capabilities of Excel.

As far as we can tell, there is no way to copy comments using advanced filtering; only the cell contents are copied. However, it is possible to easily copy the comments using a two-step process.

First, use advanced filtering to filter your data, but make sure you do the filtering in-place; don't specify that you want the information copied to a different location. You end up with a filtered list, showing only the cells that meet your criteria. Next, select the cells returned by the filtering. You should then make sure that Excel knows you only want the visible cells selected:

  1. Press F5 to display the Go To dialog box.
  2. Click Special to display the Go To Special dialog box. (See Figure 1.)
  3. Figure 1. The Go To Special dialog box.

  4. Make sure the Visible Cells Only option is selected.
  5. Click on OK.

With the visible cells selected (those hidden by the filtering are not selected), you are ready for the second step: Copy the cells to another location using normal editing techniques. The result is that the comments are copied right along with the cell contents.

If you perform this task quite a bit and it even bugs you to do the two steps, you could automate the task. The following macro will apply an advanced filter in-place, copy the visible cells to the Clipboard, and then paste them (and their comments) into a new workbook:

Sub AdvancedFilter_AndCopyComments()
    With Range("Database")
        ' filter the data range
        .AdvancedFilter Action:=xlFilterInPlace, _
          CriteriaRange:=Range("Criteria"), Unique:=False
        ' copy visible cells only
        .SpecialCells(xlCellTypeVisible).Copy
    End With

    ' goto to another worksheet
    Sheets("Sheet1").Select
    ' and paste the copied data
    With Range("A1")
        .PasteSpecial xlPasteColumnWidths
        .PasteSpecial xlPasteAll
    End With

    Application.CutCopyMode = False
End Sub

The macro assumes you have two named ranges set up: one for the data to be filtered (Database) and the other for the filtering criteria (Criteria). Run the macro, and the filtered, commented information ends up on Sheet1.

Note:

If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (3169) 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: Copying Comments when Filtering.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Viewing Your Document Full-Screen

Want to see the absolute most of your document that you can? Then you need to become familiar with the full-screen ...

Discover More

Squaring Table Cells

Inserting a table is fast and easy in Word. You may want to make sure that the cells in the table are as square as ...

Discover More

Counting All Characters

Need to know how many characters there are in a workbook? You can find out easily with the handy macro introduced in this ...

Discover More

Program Successfully in Excel! This guide will provide you with all the information you need to automate any task in Excel and save time and effort. Learn how to extend Excel's functionality with VBA to create solutions not possible with the standard features. Includes latest information for Excel 2024 and Microsoft 365. Check out Mastering Excel VBA Programming today!

More ExcelTips (menu)

Performing Calculations while Filtering

The advanced filtering capabilities of Excel allow you to easily perform comparisons and calculations while doing the ...

Discover More

Extracting Targeted Records from a List

When working with large amounts of data, you may have a need to extract just the information that meets the criteria you ...

Discover More

Copying the Results of Filtering

Filtering is a great asset when you need to get a handle on a subset of your data. Excel even makes it easy to copy the ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 0 + 1?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.