+ Reply to Thread
Results 1 to 3 of 3

Automatically delete cell text and create bottom border

  1. #1
    Registered User
    Join Date
    05-20-2010
    Location
    Walla Walla, WA
    MS-Off Ver
    Excel 2007
    Posts
    2

    Automatically delete cell text and create bottom border

    I have a table with alpha sorted names in column A. I would like to create a macro that will look at the text in A3, comparing it to A2. If they are the same, then delete the text in A3, and move on to compare A4 to A2. If A4 is different, then put a bottom border on A3:E3, and start new comparisons starting now with A4 and A5.

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Automatically delete cell text and create bottom border

    Try this macro
    Please Login or Register  to view this content.
    Does that work for you?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Forum Contributor
    Join Date
    08-11-2009
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    149

    Re: Automatically delete cell text and create bottom border

    You can also use conditional formatting. Note: I'm using Excel 2003 and it gets flakey if more than one condition applies to a cell, so instead of bottom border on the last cell in a match, we can top border the first cell. This way, the last cell (and any middle cells) can be turned to a text color of white {white text color can be flakey too, you might need to format your full range to black text and then reapply the white conditional format}

    Select your whole range of values you want the formatting to apply to, then Format / Conditional Formatting, change condition 1 to "formula is" and type the formula =A2<>A1 [this assumes your range starts at A2 and that A1 has a header that doesn't match] and click the format button, click the Border tab and set the TOP border as a line.
    Now add another condition, change it to "formula is", type the formula =A1=A2 [again assuming your selected range starts at A2], click the format button and on the font tab change color to white.
    You may need to manually put an underline border on your last row.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1