+ Reply to Thread
Results 1 to 16 of 16

select next sheet based on ending of month for year for previous sheet

  1. #1
    Forum Contributor
    Join Date
    05-25-2022
    Location
    Asia
    MS-Off Ver
    2019
    Posts
    225

    select next sheet based on ending of month for year for previous sheet

    I need to macro when the date of month for the lastrow from the year reach to finshing , then should move to next sheet . every sheet contains date in column A for instance when finish the date of JAN for the year into last row 1/31/ 2020 , then should move to next sheet contains month FEB and when finish the date of FEB for the year into last row 2/28/2020 then should move to next sheet contains month MAR and so on and when finishing DEC month and enter in new year 2021 ,then should start from sheet is relating for the new year from JAN month and so on for new year .
    sorry I can't post the result because depends on select the sheet for eavery lastrow contains ending of month for the year .
    when repeat the finishing of date should depend on the last row .
    also I posted here
    https://www.mrexcel.com/board/thread...sheet.1226725/
    Attached Files Attached Files
    Last edited by abdo M; 01-16-2023 at 08:36 AM.

  2. #2
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,600

    Re: select next sheet based on ending of month for year for previous sheet

    Try
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  3. #3
    Forum Contributor
    Join Date
    05-25-2022
    Location
    Asia
    MS-Off Ver
    2019
    Posts
    225

    Re: select next sheet based on ending of month for year for previous sheet

    thanks.
    can you check the file ,please?
    it shows MsgBox "Sheet not Found when the sheet3 is active , then should move to next sheet4 , but it doesn't happen .
    I no know what my mistake !
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,600

    Re: select next sheet based on ending of month for year for previous sheet

    In previous file it is given that the sheet starts from 1st of month. This file starts from 20th of the month. I.
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    05-25-2022
    Location
    Asia
    MS-Off Ver
    2019
    Posts
    225

    Re: select next sheet based on ending of month for year for previous sheet

    thanks . not always the date will start day from 1 . could be 12, 15 ,20 ....
    it doesn't seem to work

  6. #6
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,600

    Re: select next sheet based on ending of month for year for previous sheet

    This code is working for me.
    Please Login or Register  to view this content.

  7. #7
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,560

    Re: select next sheet based on ending of month for year for previous sheet

    Simply
    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    05-25-2022
    Location
    Asia
    MS-Off Ver
    2019
    Posts
    225

    Re: select next sheet based on ending of month for year for previous sheet

    @kvsrinivasamurthy now it works greatly و but not like jindon's code . your code depends on Sequentially based on successive months
    but not always the months will be successively .
    @ jindon your code is awesome !
    but guys ,did you read this ?
    and when finishing DEC month and enter in new year 2021 ,then should start from sheet is relating for the new year from JAN month and so on for new year .
    when finish year 2020 should move to the next sheet start from 2021 year and when finish year 2021 should move the next sheet start from 2022 year and so on when enter new year
    thanks for you .
    Last edited by abdo M; 01-17-2023 at 06:00 AM.

  9. #9
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,560

    Re: select next sheet based on ending of month for year for previous sheet

    Explain when you are at last sheet, what should happen?

    Doesn't matter what year/ month it is.

  10. #10
    Forum Contributor
    Join Date
    05-25-2022
    Location
    Asia
    MS-Off Ver
    2019
    Posts
    225

    Re: select next sheet based on ending of month for year for previous sheet

    Explain when you are at last sheet, what should happen?
    when finish year should move to next sheet start from new year whatever starting the month
    if I have the last sheet start date 02/15/2021
    and precede last sheet 06/30/2020 contains ending of the month for previous year , then will move to last sheet until finishing for the last mont for 2021 year up to last sheet contain 2021 and if the last sheet start from 05/15/2022 and precede last sheet sheet 31/09/2021 contains ending of the month for previous year then will move to last sheet and move to next sheet until finishing 2022 year
    ending of year for last month for the last sheet will move to next sheet contains new year.

  11. #11
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,560

    Re: select next sheet based on ending of month for year for previous sheet

    No, you are not answering to my question.

    Whatever the year/month the last sheet, say Dec/2022.
    It is the last sheet.
    What should happen next?

    Create a new sheet? or what?

  12. #12
    Forum Contributor
    Join Date
    05-25-2022
    Location
    Asia
    MS-Off Ver
    2019
    Posts
    225

    Re: select next sheet based on ending of month for year for previous sheet

    Create a new sheet? or what?
    yes I will creat new sheet for the next year 2023, then will move from last sheet DEC 2022 to sheet strating from 2023 year and will move to next sheet until finish 2023 year and repeat this process for next year.
    Last edited by abdo M; 01-17-2023 at 05:25 AM.

  13. #13
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,560

    Re: select next sheet based on ending of month for year for previous sheet

    Then what's wrong with my code?

    My code returns to the first sheet after the last sheet.

  14. #14
    Forum Contributor
    Join Date
    05-25-2022
    Location
    Asia
    MS-Off Ver
    2019
    Posts
    225

    Re: select next sheet based on ending of month for year for previous sheet

    Then what's wrong with my code?
    my apologies !!
    I made mistake without finish the last day of the month in the last row for last sheet
    Sorry for wasting your time unnecessarily
    thanks very much for your solution and time

  15. #15
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,600

    Re: select next sheet based on ending of month for year for previous sheet

    What about my revised code in post#6.

  16. #16
    Forum Contributor
    Join Date
    05-25-2022
    Location
    Asia
    MS-Off Ver
    2019
    Posts
    225

    Re: select next sheet based on ending of month for year for previous sheet

    What about my revised code in post#6.
    I have ever told you in post#8
    your code depends on Sequentially based on successive months
    but not always the months will be successively .

+ 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] Formulas for Subcategory Amounts Based on Month and Year from Transactions Sheet
    By BillySpivy in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 09-16-2021, 05:49 AM
  2. Replies: 1
    Last Post: 01-11-2021, 06:34 PM
  3. Replies: 8
    Last Post: 03-27-2020, 11:39 AM
  4. Replies: 11
    Last Post: 05-18-2016, 07:25 PM
  5. Move Ending Balance From Previous Sheet
    By AEvans190 in forum Excel General
    Replies: 15
    Last Post: 06-13-2015, 03:28 PM
  6. Get the values from one sheet to another sheet according to year n month
    By beneesetas14 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-21-2015, 01:31 AM
  7. Macro to add sheet, name it based on previous sheet, and delete a range of cells
    By Moeshell in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-24-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