+ Reply to Thread
Results 1 to 24 of 24

Help with calendar

  1. #1
    Registered User
    Join Date
    11-30-2012
    Location
    Philadelphia, PA
    MS-Off Ver
    Office Professional Plus 2010
    Posts
    27

    Help with calendar

    Hi,
    Questions:
    I'm wrestling with a calendar spreadsheet and can't even figure out how it works. I'm having problems figuring out the IF/THEN statement that drives the month's day cells, and how the little cell with "1902" relates to the year in the upper left corner. Those are my frustrations.

    Problem:
    What I'm trying to do is generate the month of December for the prior year located in the upper left of the month area. Our company calendar year includes the last two weeks of the prior year for payroll and leave balances (I hate when companies do that and use a 26 pay period schedule!!!). Anyway as you see it I copied and pasted the month of December from the lower right and put it at the upper left. But I need to fix it so the days fall on the right days of the week.

    Bonus:
    Ultimately I'd like to enter the dates at the left and have it automatically highlight the calendar on the right according to the green, red, and blue color coding. Currently I do this manually.

    Any help answering my questions and solving my problem would be greatly appreciated.

    Thanks,
    Kris
    Attached Files Attached Files

  2. #2
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Help with calendar

    First of all, I made your calendar work as you like.
    You can change the year by clicking on the Up/Down arrows in cell A1. This changes the values of cell E11 and I3 adn all the calendar cells as well. Or you can write directly in cell E11. Note that this is the only place you should change the year of this calendar.

    It uses a named range (as DecSun1) to find the date of the first sunday in decembre. But it works for the current year only. On your month of December of the previous year, I created a new named range (DecSun2) which finds the first Sunday in december of the previous year. Now, your calendar is working as you like.
    Next, I'll look at your coloring thing. It will require a macro. Is tis OK with you and your company?
    Attached Files Attached Files
    Pierre Leclerc
    _______________________________________________________

    If you like the help you got,
    Click on the STAR "Add reputation" icon at the bottom.

  3. #3
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Help with calendar

    There is something strange about the calendar in that the dates disappear from parts of the calendar when the scroll is used.

    I have made a simple calendar where you enter the day month and year and it populates the month. It isn't sophisticated but it does work.
    Attached Files Attached Files
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  4. #4
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Help with calendar

    Hi Kris,
    look at the attached modified workbook.
    I made some changes so it should work as required.
    You'll see light yellow cells for holidays' dates. Those are the cells the macro will look for dates to color the calendar. It must be a valid date in those cells. Nothing else.
    I created 2 buttons. One to color the holidays' dates and the other one to revert the coloring before you change any dates. You may always change the color manually though.
    Hope this helps.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    11-30-2012
    Location
    Philadelphia, PA
    MS-Off Ver
    Office Professional Plus 2010
    Posts
    27

    Re: Help with calendar

    Thanks for all of your help guys. It's nice to work with experts.

    p24leclerc,
    I played around with your revisions of my calendar. The first one works perfectly and I'd call that a resounding success. As I said the color coding was just a bonus. So I opened that file as well and I can see what you are describing regarding the yellow regions. However I'm not sure if it's working. By the way I'm using Office 2010 not sure if that matters. The month cells are all while and when I click on "color vacation days" the calendar blink for a second but then go back to all white.

    General Question:
    What are these named ranges you speak of (DecSun1 and Decsun2)? I never heard of such a thing. Are they functions in Excel or custom to the this workbook and if so where are they defined?

    -Kris

  6. #6
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Help with calendar

    Here it is working now.
    I just learned that once the search parameter is set to look in VALUES, it continues with this parameters as long as it is not changed. In the macro, I did not specified to look in Values so when you opened the workbook, it was kind of reset to look in FORMULAS (default value) instead of VALUES. That's why it was not working anymore. I modified the macro so you won't have this problem again.

    About the NAMED RANGE now. They are defined by the user. Look in the menu FORMULAS and then NAME MANAGER. If you do this while in your calendar workbook, you'll see lots of names with, at the bottom of the window, the REFER TO: section. There you can specify a specific cell, a range of cells or a formula that will result either in a value or a range of cells.
    You can easily define a Named range by entering a name in the cell address section at the left of the formula bar at the top of the Excel window. Click like in cell E2 and then click in that section where you see E2 and type any name you want. That cell can now be referenced by its name instead of by its address. This can be very usefull when you have big formulas. It is easier to understand a formula when it says =Total_Price * Percent_Discount instead of = E2* C5 or whatever.
    It is a very powerfull side of Excel.

    Hope it works great for you now.
    Regards
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    11-30-2012
    Location
    Philadelphia, PA
    MS-Off Ver
    Office Professional Plus 2010
    Posts
    27

    Re: Help with calendar

    p24leclerc,
    Your command of Excel is impressive. Thank you. Where can I see your macro coding in the spreadsheet so I can learn how to do this in the future?

    -Kris

  8. #8
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Help with calendar

    you need to go to the Visual Basic Editor. You can this by clicking ALT + F11.
    In VBE, you double click on the module name and you'll see the macros.
    Regards

  9. #9
    Registered User
    Join Date
    11-30-2012
    Location
    Philadelphia, PA
    MS-Off Ver
    Office Professional Plus 2010
    Posts
    27

    Re: Help with calendar

    I seemed to have run into an error. Something about the links from this file. Attached you'll see the screen shots. Is the file (w/associated macros) all inclusive or is it talking about internal links to cells, etc.? I moved some stuff around and adjusted your VB code to make sure the cell names still captured the appropriate regions.

    -Kris
    Attached Images Attached Images

  10. #10
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Help with calendar

    I did not create any link, they are all from you. If you don't need this one, just click on "Break link" and you should be good.

  11. #11
    Registered User
    Join Date
    11-30-2012
    Location
    Philadelphia, PA
    MS-Off Ver
    Office Professional Plus 2010
    Posts
    27

    Re: Help with calendar

    Do you know what this link is or how it originated? I didn't intentionally make it. I just copied your sheet into my workbook as sheet 1 and then moved some stuff around on the sheet.

  12. #12
    Registered User
    Join Date
    11-30-2012
    Location
    Philadelphia, PA
    MS-Off Ver
    Office Professional Plus 2010
    Posts
    27

    Re: Help with calendar

    I just tried to break the link and now the two buttons don't work. When I put the cursor over the button, it recognizes it as a drawing box not an active button.

    -Kris

  13. #13
    Forum Expert
    Join Date
    12-11-2011
    Location
    Netherlands
    MS-Off Ver
    office 365
    Posts
    3,724

    Re: Help with calendar

    Take a look at this
    The only thing I did not do is the red coloring.
    I dont know which cells you want colored
    Attached Files Attached Files
    Willem
    English is not my native language sorry for errors
    Please correct me if I'm completely wrong

  14. #14
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Help with calendar

    I like Popipipo solution as it does not involve MACROS.
    For the RED cells, just duplicate the conditional formatting but enter only dates in column A.

    Kris, I don't know what to say about the link. I did not create it myself and it should not affect the buttons either. I'm lost. Can you attached your file?

  15. #15
    Registered User
    Join Date
    11-30-2012
    Location
    Philadelphia, PA
    MS-Off Ver
    Office Professional Plus 2010
    Posts
    27

    Re: Help with calendar

    I'll take a look at popipipo's version later today when I have a chance. In the meantime I'm attaching my current file with the link problem and if the links are broken, the inactive button problem.
    Attached Files Attached Files

  16. #16
    Forum Expert
    Join Date
    12-11-2011
    Location
    Netherlands
    MS-Off Ver
    office 365
    Posts
    3,724

    Re: Help with calendar

    The buttons are inactive because ther are no macro's

    Try to avoid merged cells, this creates problems!
    Take a look at this updated file
    Attached Files Attached Files

  17. #17
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Help with calendar

    Kris, in Excel 2007 and up, there are usually 2 types of Excel files.
    *.xlsx which do not support macros
    *.xlsm which DO support macros.
    When you save an xlsm file to an xlsx type, it drops the macro.

  18. #18
    Registered User
    Join Date
    11-30-2012
    Location
    Philadelphia, PA
    MS-Off Ver
    Office Professional Plus 2010
    Posts
    27

    Re: Help with calendar

    Ah ok. Thanks for all of your help. I think I'm up and running now. You guys are the best.

  19. #19
    Registered User
    Join Date
    11-30-2012
    Location
    Philadelphia, PA
    MS-Off Ver
    Office Professional Plus 2010
    Posts
    27

    Re: Help with calendar

    Hey Guys,
    I'm running into a new error message that seems strange. See the attached spreadsheet and error message. It occurs when I copy a tab to make a new two week time recording period. I have to accept the error 12 times (one for each month) and then it works and I rename it according to the beginning date of the time period. It would be nice if this error didn't occur. Any thoughts?

    -Kris
    Attached Images Attached Images
    Attached Files Attached Files

  20. #20
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Help with calendar

    There is a named range that has the name AprSun1 for both the destination worksheet and the range that you are copying onto the destination worksheet. These named ranges may or may not have the same definition in the formula bar for named ranges. Rename the named range on the range being copied to something that doesn't exist elsewhere and then copy to the destination worksheet. If the name change in the copied range has affected some formulae, make the changes necessary to regain functionality.

  21. #21
    Registered User
    Join Date
    11-30-2012
    Location
    Philadelphia, PA
    MS-Off Ver
    Office Professional Plus 2010
    Posts
    27

    Re: Help with calendar

    This will be an ongoing thing though. Every two weeks I create another tab to record my time. I don't want to rename everything ever time I do this. Is this problem a side effect of using named ranges (which by the way I don't fully understand what named ranges are in the first place). p24leclerc and popipipo helped me create this spreadsheet and it's a little above my head frankly. It works great except for this issue.

  22. #22
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Help with calendar

    You are probably defining names using the Formula Tab, Define Name and then naming a range with the scope being the worksheet that you are on. This name is then being used in a formula. When you copy and paste this named range along with formulae that use the name, you will get the message.

    If you use Workbook as the scope for names, you will not be permitted to use the same name for different ranges, even on other worksheets. The problem is therefore eliminated before it gets started.

  23. #23
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Help with calendar

    here is your workbook with the offending named range deleted.
    The only sheet that needs named range is the '2015 Calendar' sheet and the 'year' named range for the YEAR drop down menu.
    I can't understand how the others were created at the first place but you should have no other ones.
    You can see those if you click on the FORMULAS ribbon menu then on NAME MANAGER menu. In the appearing window, you should see the 12 named range used by sheet 2015 Calendar. They are all named like AprSun1 or JulSun1 meaning the first day of the month. It has a formula giving the first day of the month.
    The only way I can see for tis to occur is to have copied the 2015 Calendar sheet to create a new sheet for your by weekly time sheet. By doing this, you create a copy of the named range in the new sheet and also their duplicates.

    With the new sheet, you should be OK.
    Regards
    Attached Files Attached Files

  24. #24
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,463

    Re: Help with calendar

    ... I can't understand how the others were created at the first place ...
    In post #11, kkundra said that he did not create the links - he just copied your sheet into his file. If your sheet had a named range, then the action of copying the sheet will also have had the effect of copying that named range, and it will point back to the original file that it came from. That is where the offending named ranges came from.

    Hope this helps.

    Pete

+ 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] macros for two push button to show up calendar/hide calendar.
    By pejoi in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-15-2014, 04:11 AM
  2. Calendar functions - linking work activities with formatted dates to calendar
    By SKSS in forum Access Programming / VBA / Macros
    Replies: 1
    Last Post: 05-14-2012, 06:38 PM
  3. Calendar VBA auto filling week and month based on calendar entry.
    By perrymagic in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-18-2011, 02:00 PM
  4. Replies: 0
    Last Post: 10-31-2011, 10:58 PM
  5. Replies: 0
    Last Post: 03-27-2008, 04:36 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