Delete new line if number of characters is less than 20

  • Hi,


    i have multiple rows in one column, where each cell contains multiple lines (char 10). I would like to keep just lines, where number of characters in each line is bigger than 20.
    The result in B2 would have 2 lines (sentences) in B3 would have 3 lines (sentences). [TABLE="border: 1, cellpadding: 1, width: 500"]

    [tr]


    [td]

    A

    [/td]


    [td]

    B

    [/td]


    [/tr]


    [tr]


    [td]

    2

    [/td]


    [td]

    [TABLE="border: 1, cellpadding: 1, width: 500"]

    [tr]


    [td]

    short
    aerewre
    This is the sentence, I would like to keep
    hg 34f 43f4
    sdifsd 23423
    Also sentence I would like to keep

    [/td]


    [/tr]


    [/TABLE]

    [/td]


    [/tr]


    [tr]


    [td]

    3

    [/td]


    [td]

    shorwerww 23233
    aerewre 333
    This is the sentence, I would like to keep and save
    hg 34f 43f4
    sdifsd 23423
    Also sentence I would like to keep
    Also sentence I would like to keep

    [/td]


    [/tr]


    [/TABLE]

    Could you please help me with VBA or either formula in Column C.


    Thank you in advance and best regards,
    Marko

  • Hi
    Excuse my english (i'm italian)
    With VBA code like this (results on column C)



    I hope helped you. Bye, bye
    Mario

  • Hi
    I beg your pardon. I did not understand correctily.
    This is the correct code


    Bye,
    Mario

  • Hi Mario,


    first i would like to thank you for your time.


    The code is not working - it breaks with Split function and returns me this error:
    "Expected variable or procedure, not module"


    Could you please check what's the issue?


    Thank you in advance and best regards,
    Marko

  • Hi Mario,


    my bad - i had module in my workbook with name "Split" and also haven't had variables accurate. Your workbook helped me a lot and saved plenty of time.


    Thank you again and all the best,
    Marko

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!