+ Reply to Thread
Results 1 to 14 of 14

Loop and fetching info from different sheet

  1. #1
    Registered User
    Join Date
    12-21-2020
    Location
    South Africa
    MS-Off Ver
    MS2016 & MS2019
    Posts
    41

    Loop and fetching info from different sheet

    Good day

    I am still very new to VBA and have just started to work with my own coding.

    I am trying to create a custom calendar from data which I have already established. I have all the dates in one column and I need it to show in my calendar weekly layout. I am trying to use loop and offset to do this.

    Please Login or Register  to view this content.
    What it is supposed to do is fill the dates in my calendar sheet by starting under my first day of the week until the last day of the week then go down to the next row and fill the 2nd week and then loop through the rest of the month. For now I am just trying to get this to work before I move to the rest of the process. The first macro formats the layout for my calendar. The second is supposed to do the above.

    Thanks in advance for any assistance
    Attached Files Attached Files
    Last edited by Rewmer; 02-04-2021 at 12:12 PM.

  2. #2
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,567

    Re: Loop and fetching info from different sheet

    Attach a normal workbook with all columns and rows showing.

  3. #3
    Registered User
    Join Date
    12-21-2020
    Location
    South Africa
    MS-Off Ver
    MS2016 & MS2019
    Posts
    41

    Re: Loop and fetching info from different sheet

    Hi, its all there you can just unhide the data sheet's columns. I hid it to make it easier as I will only be using that column. Or am I misunderstanding your request?
    Last edited by Rewmer; 02-04-2021 at 01:31 PM.

  4. #4
    Registered User
    Join Date
    12-21-2020
    Location
    South Africa
    MS-Off Ver
    MS2016 & MS2019
    Posts
    41

    Re: Loop and fetching info from different sheet

    The first macro does the layout for the calendar. So it automatically adds the weekdays and set the columns. Do you want me to run it then save it like that then reupload it? Is that what you are refering to? If so, here it is.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    12-21-2020
    Location
    South Africa
    MS-Off Ver
    MS2016 & MS2019
    Posts
    41

    Re: Loop and fetching info from different sheet

    Ok, I now managed the loop but its doing the same thing in every cell. Its supposed to progress like a calendar eg 1 Nisan 2 Nisan 3 Nisan etc.

    Here is the code I have managed so far for the 2nd macro. There is only 2x macros.

    Please Login or Register  to view this content.

  6. #6
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,567

    Re: Loop and fetching info from different sheet

    Explain in a concise manner what you want to do.
    I can't see this being it but then stranger things have happened.
    Just a stab at it.
    Please Login or Register  to view this content.
    Last edited by jolivanes; 02-03-2021 at 02:27 PM.

  7. #7
    Registered User
    Join Date
    12-21-2020
    Location
    South Africa
    MS-Off Ver
    MS2016 & MS2019
    Posts
    41

    Re: Loop and fetching info from different sheet

    Well consider this as "strange" then lol

    I tweeked the code a bit so the start date is 1 Nisan with this code:

    Please Login or Register  to view this content.
    What I need now is to be able to select year and month. This will be according to column Q for year and M for month. I need to be able to see eg the month of Nisan for 2021/2022 or others options in the above columns.

    Thx for assistance!
    Last edited by Rewmer; 02-04-2021 at 01:32 PM.

  8. #8
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,567

    Re: Loop and fetching info from different sheet

    Please don't quote needlessly.

    If you needed to tweak the code as you mentioned then your workbook is different from your attachment.
    But as long as you have your requested answer and it works to the way you want, that's the important thing.

    In your last attachment, Column M is days, not months.
    When you say that you need to see the month of Nisan, what does that mean?
    Last edited by jolivanes; 02-04-2021 at 12:27 PM. Reason: Added info

  9. #9
    Registered User
    Join Date
    12-21-2020
    Location
    South Africa
    MS-Off Ver
    MS2016 & MS2019
    Posts
    41

    Re: Loop and fetching info from different sheet

    Its the same. I just made i=45 to read i=14. I see its i15. Maybe I had a typo when doing it.

    Thanks again.
    Last edited by Rewmer; 02-04-2021 at 01:33 PM.

  10. #10
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,567

    Re: Loop and fetching info from different sheet

    #2 under Forum Guidelines in the Forum Rules:
    Don't quote whole posts -- it's just clutter.*

    I added some questions to Post #8 that you might have missed while submitting your Post #9.

  11. #11
    Registered User
    Join Date
    12-21-2020
    Location
    South Africa
    MS-Off Ver
    MS2016 & MS2019
    Posts
    41

    Re: Loop and fetching info from different sheet

    Yes I did miss your questions.

    Month = P
    Year = Q

    What I mean is that I need to be able to select the month and year according to above columns so that I end up with only one month's info in the calendar.

  12. #12
    Registered User
    Join Date
    12-21-2020
    Location
    South Africa
    MS-Off Ver
    MS2016 & MS2019
    Posts
    41

    Re: Loop and fetching info from different sheet

    Oh yes, my sample only has one year but I have 10yrs info in my original file.

  13. #13
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,567

    Re: Loop and fetching info from different sheet

    There are 29 "01 Nisan" entries (all the same) and 350+ 2021/2022 entries (all the same).
    If you select one of them, what do you want to do then? Put "1 Nisan" into the CALENDAR sheet?
    Or just all the Nisan values (1 Nisan to 29 Nisan) into the CALENDAR sheet?

  14. #14
    Registered User
    Join Date
    12-21-2020
    Location
    South Africa
    MS-Off Ver
    MS2016 & MS2019
    Posts
    41

    Re: Loop and fetching info from different sheet

    On my original file I have 10yrs of info. I would like to see eg:

    Nisan 2021/2022 or Zif 2024/2025 or Adar 2027/2028

    I need there to be a choice, maybe dropdown or allow to enter choice in cell. I am going to use A2 for typing in the month and E2 for the year. Maybe those cells can be the source for what needs to be filtered?

+ 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] Fetching data from another sheet
    By Patwardhan in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 08-04-2018, 03:22 AM
  2. Button takes info from Sheet 1, transcribes to Sheet 2, info deletes on Sheet 1
    By LNT225 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-02-2016, 04:54 PM
  3. [SOLVED] Loop through sheets to gather info on first sheet
    By amphinomos in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-04-2014, 07:52 AM
  4. [SOLVED] Fetching average from another sheet.
    By Khoori7 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-24-2013, 09:57 PM
  5. Replies: 0
    Last Post: 11-05-2013, 01:51 AM
  6. Replies: 1
    Last Post: 12-28-2012, 07:24 AM
  7. Replies: 1
    Last Post: 12-28-2012, 03:46 AM

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