+ Reply to Thread
Results 1 to 10 of 10

VBA - Copy range of dates and paste values with format "yyyy/mm"

  1. #1
    Registered User
    Join Date
    02-01-2017
    Location
    Lisboa
    MS-Off Ver
    2010
    Posts
    81

    VBA - Copy range of dates and paste values with format "yyyy/mm"

    Hello

    I need to create a macro that copy only the cells of a range that contains values of Dates (the cells that not a have a blank string ("")) and paste the copied dates in other column but in the format “yyyy/mm”.

    I am not very good with vba, I found a code that copy a formula but when I change it, it gives me an error…

    Please Login or Register  to view this content.

    I hope someone can help me..


    Thank you in advanced!

  2. #2
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,737

    Re: VBA - Copy range of dates and paste values with format "yyyy/mm"

    This works:

    Please Login or Register  to view this content.
    Happy with my answer * Add Reputation.
    If You are happy with solution, please use Thread tools and mark thread as SOLVED.

  3. #3
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,029

    Re: VBA - Copy range of dates and paste values with format "yyyy/mm"

    How about
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    02-01-2017
    Location
    Lisboa
    MS-Off Ver
    2010
    Posts
    81

    Re: VBA - Copy range of dates and paste values with format "yyyy/mm"

    Hello,

    Thank you for the quick reply!

    I don't know what is happening but when the formula is copy down in the column "B" the dates of column "A" changes..
    It is possible to only copy the values "yyyy/mm" and not the formulas?

    Thank you in advance

  5. #5
    Registered User
    Join Date
    02-01-2017
    Location
    Lisboa
    MS-Off Ver
    2010
    Posts
    81

    Re: VBA - Copy range of dates and paste values with format "yyyy/mm"

    Hello Fluff13,

    Your vba code is perfect, It works exactly as is need!
    A thousand thanks for your help and expertise!!!

  6. #6
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,029

    Re: VBA - Copy range of dates and paste values with format "yyyy/mm"

    You're welcome & thanks for the feedback

  7. #7
    Registered User
    Join Date
    02-01-2017
    Location
    Lisboa
    MS-Off Ver
    2010
    Posts
    81

    Re: VBA - Copy range of dates and paste values with format "yyyy/mm"

    Hello,

    I am sorry to come back to ask for help on this thread again...

    But I adapt the code to me workbook and I came across with a little problem.

    I have the range of information (columns A and B) in Sheet1:"BD" but I need to create a button to run the code in Sheet2:"Sales"

    I have tried to add some code with the reference of Sheet1("BD") but It doesn’t work….

    Is there a way to run this code in Sheet2 through a button?

    Thank you in advance.

  8. #8
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,029

    Re: VBA - Copy range of dates and paste values with format "yyyy/mm"

    Try
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    02-01-2017
    Location
    Lisboa
    MS-Off Ver
    2010
    Posts
    81

    Re: VBA - Copy range of dates and paste values with format "yyyy/mm"

    Hello Fluff13,

    The code has worked, I made a test and I already adapted my workbook with this solution.

    A thousand thanks for your help and expertise!!!

  10. #10
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,029

    Re: VBA - Copy range of dates and paste values with format "yyyy/mm"

    You're welcome & thanks for the feedback

+ 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. Replace date in "DD.MM.YYYY" with date "DD/MM/YYYY" format as soon as user hits enter
    By abhinavbinkar in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-14-2019, 09:12 AM
  2. Replies: 35
    Last Post: 06-21-2017, 09:56 PM
  3. [SOLVED] VBA Get the Date Format Change As "MM-DD-YYYY" In Range
    By breadwinner in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-20-2014, 10:37 AM
  4. sumif based on year value from column with dates in "mm/dd/yyyy" format
    By Willardio in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-27-2013, 04:58 PM
  5. [SOLVED] Convert from "general" (YYYYMMDD) to specific "custom" format (YYYY.MM.DD)
    By Ella_p in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-10-2013, 02:23 AM
  6. Replies: 0
    Last Post: 10-14-2012, 05:48 PM
  7. Replies: 1
    Last Post: 01-19-2011, 03:26 PM

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