+ Reply to Thread
Results 1 to 13 of 13

ClearContents underlined cells within a range

  1. #1
    Forum Contributor
    Join Date
    04-14-2014
    Location
    Philippines
    MS-Off Ver
    2007, 2010, 2013, 2016.
    Posts
    169

    ClearContents underlined cells within a range

    Hi.
    I need VBA help to clearcontents all underlined text within this range A1:I9.
    and at the same time roll back to default text format where underlined cell was cleared.
    thanks

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: ClearContents underlined cells within a range

    Not sure I understand the second request

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    04-14-2014
    Location
    Philippines
    MS-Off Ver
    2007, 2010, 2013, 2016.
    Posts
    169

    Re: ClearContents underlined cells within a range

    AB33

    thanks for your quick reply.
    the second request is to clear next input to those cleared cells being underlined.

    thanks

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: ClearContents underlined cells within a range

    Let's say A1 is underlined and A2 is not. What do you want to do with each cell?
    Last edited by AB33; 01-26-2022 at 10:50 AM.

  5. #5
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: ClearContents underlined cells within a range

    Do you mean

    Please Login or Register  to view this content.
    ?

  6. #6
    Forum Contributor
    Join Date
    04-14-2014
    Location
    Philippines
    MS-Off Ver
    2007, 2010, 2013, 2016.
    Posts
    169

    Re: ClearContents underlined cells within a range

    AB33,
    A1 is cleared from underline. next input to A1 should be like A2.
    regular. no format. by the way, all underlined cells are manually formatted by pressing U.
    thanks again

  7. #7
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: ClearContents underlined cells within a range

    So you want the cleared cells to be formatted as normal. Right?
    replace
    Cel = "'" & Cel

    with
    Cel.NumberFormat = "@"

  8. #8
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: ClearContents underlined cells within a range

    Hmm! Sorry I now got it.
    Clearcontents does not clear the formats but only values

    Please Login or Register  to view this content.
    Last edited by AB33; 01-26-2022 at 11:10 AM.

  9. #9
    Forum Contributor
    Join Date
    04-14-2014
    Location
    Philippines
    MS-Off Ver
    2007, 2010, 2013, 2016.
    Posts
    169

    Re: ClearContents underlined cells within a range

    AB33,
    I have replace the code.
    Cel = "'" & Cel to Cel.NumberFormat = "@"
    the underline format is still present.

  10. #10
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: ClearContents underlined cells within a range

    Did you check my code #8?

  11. #11
    Forum Contributor
    Join Date
    04-14-2014
    Location
    Philippines
    MS-Off Ver
    2007, 2010, 2013, 2016.
    Posts
    169

    Re: ClearContents underlined cells within a range

    AB33.

    Your code does the job. Thank you!
    Last edited by getafixkwik; 01-26-2022 at 11:23 AM.

  12. #12
    Forum Expert
    Join Date
    10-11-2021
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    1,377

    Re: ClearContents underlined cells within a range

    How about

    Please Login or Register  to view this content.

  13. #13
    Forum Contributor
    Join Date
    04-14-2014
    Location
    Philippines
    MS-Off Ver
    2007, 2010, 2013, 2016.
    Posts
    169

    Re: ClearContents underlined cells within a range

    Hi JEC.
    Thanks for your input.
    please refer to #6. Solution provided on #8.
    Thank you.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] find same value in a range and clearcontents
    By incobart in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 07-16-2019, 11:47 PM
  2. [SOLVED] ClearContents with Range
    By Keibri in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-06-2019, 12:52 PM
  3. ClearContents of all other Cells in Range if "Y" in List Box is selected
    By WilliamL83 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-10-2018, 07:45 PM
  4. [SOLVED] Range clearcontents
    By tradinup2 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-12-2013, 03:38 PM
  5. ClearContents of a range of cells in on sheets bar 5
    By Juenapa in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-08-2011, 05:18 AM
  6. Clearcontents of range on multiple worksheets
    By stephenw in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-28-2007, 10:37 AM
  7. Can parital cells be underlined w/o inserting blank columns?
    By FinancialStmtProb2006 in forum Excel General
    Replies: 2
    Last Post: 05-28-2006, 10:50 AM

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