How To Obtain The Dates Inserted In Column "C" That Are Inside The Quotations For Each Row

  • MODERATOR NOTICE: This topic has also been posted on other sites and may already have an answer elsewhere. Please take this into consideration when answering this question

    https://www.myonlinetraininghub.com/excel-forum/vba-macros/how-to-obtain-the-dates-inserted-in-column-c-that-are-inside-the-quotations-for-each-row


    Hello everyone my name is Maurizio and my problem is this:

    I understand that for some people, this request of mine may seem silly and much more.

    But since I don't know if it is possible, I have less to create all this

    I propose it to you anyway; If nothing else, I will be able to increase my knowledge of programming.

    Having said that I repeat the problem and this:


    In an Excel sheet I would like to write in Column (A1: A31) the dates ranging from (01/01/2022) to

    (31/01/2022) and so far everything is ok


    Now what I would like to know and if it were possible to obtain the Same thing this time inserted in the Column (C1: C31) but it has this type of format ("01/01/2022") to ("31/01/2022")

    Surely Leveraging The VBA

    For more information on how I would like to achieve as a final result

    Look at this image


    [img] https://i.postimg.cc/D0vtcBmT/Aiuto-Date.jpg [/ img]


    Thanks Since Now For All The Help You Will Want To Give Me About Saliti da A.MaurizioModifica_Data_Nella_Colonna_C_Con_Il_VBA.xlsm

  • Hello rollis13

    First I want to thank you for your intervention, but while trying all the changes I know

    The Only Thing I Can Get Even Adding The (Format) Is This:

    Code
        Range("C2").Select
        ActiveCell.FormulaR1C1 = Range("C2").Value & ("""\gg/mm/aaaa\""")
        Range("C3").Select

    See also the photo that gives me as a final result

    But maybe it is I who am wrong in something.

    Greetings and thanks anyway

  • This would be the syntax for cell C2 in a macro:

    Code
    Range("C2").NumberFormat = "\""dd/mm/yyyy\"""

    but it would be quicker if you manually select the entire column and apply \"gg/mm/aaaa\" as Custom Format to the cells.

  • You can do this with a formula, no need for VBA.


    Your 2 images are different, you have a header in the second one and dates start in A2, the first image has no header and dates starting in A1


    If you do have a header put this in C2 and copy down as far as you want


    =IF(A2="","",""""&TEXT(A2,"dd/mm/yyyy")&"""")


    If no header then change A2 in the formula to A1, put formula in C1 and copy down.


    You can copy the formula down for more rows that there are dates, if a cell in column A is empty then the formula will make the cell in column C blank.

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • Hello to all of you Forum

    And especially a (rollis13) and a (KjBox)

    Because your interventions have been Superlative

    I honestly Speaking I would never have gotten to do such a thing; Despite having tried and tried several times.

    Therefore Thanks Really

    Greetings and good day and good job to all from A.Maurizio

  • rory

    Added the Label Cross Post
  • You're welcome

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • Hi Hi KjBox Listen:

    I wanted to try your formula which is this:


    But he continues to give them Erendere in this Sector:

    See the first

    Code
    = IF (A2 = "", "", "" "" & TEXT (A2; "dd / mm / yyyy") & "" "")

    And the error that appears to me has this written

    And the error that appears to me has this written


    In your opinion why

    And how can I overcome this inconvenience!

    Thank you

  • It would appear that your locale settings are different from mine, and semicolons are used rather than commas


    Try


    =IF(A2="";"";""""&TEXT(A2;"dd/mm/yyyy")&"""")


    or maybe


    =IF(A2="";"";""""&TEXT(A2;"gg/mm/aaaa")&"""")


    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • To like a post click on the smiley icon bottom left of post.

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

Participate now!

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