+ Reply to Thread
Results 1 to 6 of 6

How to auto fill the last month next 4 quarter when type only one moth of previous quarter

  1. #1
    Registered User
    Join Date
    10-17-2017
    Location
    Vietnam
    MS-Off Ver
    2010
    Posts
    26

    How to auto fill the last month next 4 quarter when type only one moth of previous quarter

    Hi all

    I want macro to auto fill the 4 quarter when type one month of previous quarter in A2

    For examble
    When I type in Cell(A2) = 202012 or 202011 or 202010, Cell(A3) autofill = 202009, Cell(A4) = 202006, Cell(A5) = 202003, Cell(A6) = 201912
    When I type in Cell(A2) = 202009 or 202008 or 202007, Cell(A3) autofill = 202006, Cell(A4) = 202003, Cell(A5) = 201912, Cell(A6) = 201909
    When I type in Cell(A2) = 202006 or 202005 or 202004, Cell(A3) autofill = 202003, Cell(A4) = 201912, Cell(A5) = 201909, Cell(A6) = 201906
    When I type in Cell(A2) = 202003 or 202002 or 202001, Cell(A3) autofill = 201912, Cell(A4) = 201909, Cell(A5) = 201906, Cell(A6) = 201903

    I attachment file with result that I want, please help me to do this with VBA code.
    Thanks./.
    Attached Files Attached Files
    Last edited by alonelove; 04-21-2021 at 11:28 PM. Reason: typo wrong

  2. #2
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,213

    Re: How to auto fill the last month next 4 quarter when type only one moth of previous qua

    Please try

    Please Login or Register  to view this content.
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    10-17-2017
    Location
    Vietnam
    MS-Off Ver
    2010
    Posts
    26

    Re: How to auto fill the last month next 4 quarter when type only one moth of previous qua

    Thanks for your reply but code working wrong

    With this code when I type Cell(A2) = 202001 or 202002 or 202003 => Result in all range is the same: Cell(A3) = 201912, Cell(A4) = 201912, Cell(A5) = 201912, Cell(A3) = 201912
    I want the correct result must be: Cell(A3) = 201912, Cell(A4) = 201909, Cell(A5) = 201906, Cell(A6) = 201903

    Please help me one time, thanks @Bo_Ry./.

  4. #4
    Registered User
    Join Date
    10-17-2017
    Location
    Vietnam
    MS-Off Ver
    2010
    Posts
    26

    Re: How to auto fill the last month next 4 quarter when type only one moth of previous qua

    Dear Bo_Ry, I've just change a small code then code work well.

    Code I change like this:

    Please Login or Register  to view this content.
    Thanks for your help again, this thread is solved.

  5. #5
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,213

    Re: How to auto fill the last month next 4 quarter when type only one moth of previous qua

    Maybe try

    Please Login or Register  to view this content.
    or

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    10-17-2017
    Location
    Vietnam
    MS-Off Ver
    2010
    Posts
    26

    Re: How to auto fill the last month next 4 quarter when type only one moth of previous qua

    Quote Originally Posted by Bo_Ry View Post
    Maybe try

    Please Login or Register  to view this content.
    Code above the same result with #2 so wrong.

    Code belove is working well:

    Please Login or Register  to view this content.
    Thanks for your kindly.

+ 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] Calculate Quarter (date) and Calculate Average of Quarter and Sum of Quarter
    By Bobbbo in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 02-26-2020, 06:16 PM
  2. Count per quarter base on previous quarter.
    By calvinle in forum Excel General
    Replies: 3
    Last Post: 04-19-2018, 03:59 PM
  3. [SOLVED] Getting previous quarter using formula
    By kay007 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-13-2016, 09:29 AM
  4. VBA Datepart return Quarter of previous month
    By matteobsuetti in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-25-2015, 03:03 AM
  5. [SOLVED] Auto fill Quarter (Q1-2012, Q2-2012...) by recognize the date
    By otterandrews in forum Excel General
    Replies: 6
    Last Post: 05-17-2012, 02:30 AM
  6. Round to previous quarter end
    By Scottmk in forum Excel General
    Replies: 2
    Last Post: 04-27-2007, 12:02 PM
  7. [SOLVED] Calculate % variance on previous quarters. Quarter %, etc. pivot
    By DaveC in forum Excel General
    Replies: 1
    Last Post: 08-08-2005, 01:45 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