+ Reply to Thread
Results 1 to 7 of 7

using a Calendar with multiple sheets.

  1. #1
    Registered User
    Join Date
    09-15-2011
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    82

    using a Calendar with multiple sheets.

    Hi everyone

    I hope someone can help me.

    We have a workbook that was used to book desks on the floor we had in our office. The work book has a calendar that was used to book desks in advance.

    Recently we acquired two other floors and have several more desks available, so we are looking at adding two more userforns to the workbook to book desks on the other two floors.

    The code used within the calendar to select the userform to book the desks is the following:

    Please Login or Register  to view this content.

    How could/would this code be adapted now that there are two other userforms for "firstfloor" and "secondfloor" using the above code the calendar only works with the groundfloor userform.

    If possible can the code be adapted so teh calendar works with all 3 userforms for the groundfllor, firstfloor and secondfloor ?

    Any help would be very much appreciated as my knowledge of VBA is very limited.

    Thanks in advance

    Ortz

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,720

    Re: using a Calendar with multiple sheets.

    We're just seeing the tip of the iceberg here. Where is CommandButton3 located? Where is this code located? Is it on a sheet, or on a userform? What are objects groundfloor and datebook?

    The code used within the calendar to select the userform to book the desks is the following:
    I don't see what you mean by "select the userform". It appears that Cal1 may be a userform and this Sub is hiding it, but other than that I can't tell what's going on.

    The best thing would be for you to attach the Excel file.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    09-15-2011
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    82

    Re: using a Calendar with multiple sheets.

    Hi

    Sorry for the delay I have just got in from work.

    My apologies for not attaching the file in the initial thread but I thought it would be too large but I have removed some parts and it seems ok to load.

    The trouble I have is the calendar links to the 2nd floor userform and so desks can be booked but it doesnt link to the Ground and First Floor userforms and so the desks at the moment cannot be booked by colleagues at work.

    I have very little knowledge of VBA but I think its something to do with the code in the calendar that I posted in thread one. I need the calendar to be able to link to the ground and first floors when thaose respective userforms are being used.

    Hope you can help Jeff or someone else with the knowledge to help.
    It would be most appreciated.

    The password for the overwrites is Kate

    Thank You

    Ortz
    Attached Files Attached Files

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,720

    Re: using a Calendar with multiple sheets.

    First, WOW. Let me get my sunglasses

    The problem is that you are making your calendar form the boss, instead of making it a servant. The calendar form should make its result available, instead of deciding what is to be done with its result.

    Update Cal1 code to include this line at the top, with the other global declarations:

    Please Login or Register  to view this content.
    Then modify your click sub to be

    Please Login or Register  to view this content.
    Let's use secondfloor as an example. Modify your code so that after the calendar is finished the result is stored appropriately.

    Please Login or Register  to view this content.
    I haven't had the time it would take to do a thorough analysis of your entire solution, but it seems that you have an enormous number of lines of code for what seems to be a straightforward task. Let me know if you need any other help.

  5. #5
    Registered User
    Join Date
    09-15-2011
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    82

    Re: using a Calendar with multiple sheets.

    You like the colour Jeff It's not my idea

    That seems to have solved it straight away.

    I'll change the code when I get to wok in the morning but it appears to be ok with this stripped down version

    Thats just awesome. I've been scratching my head looking at this for a week now.

    Thank you so much Jeff.

    I'll give you some feedback when I've changed it at work.

    Much appreciated

    Thank you again

    Ortz

  6. #6
    Registered User
    Join Date
    09-15-2011
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    82

    Re: using a Calendar with multiple sheets.

    Hi Jeff

    Thanks for the previous help.

    I have tried the changes you highlighted and it works perfectly with the Second Floor

    However I altered the code exactly the same for the Ground and the First Floor and there is a problem. It works ok for one booking/entry but then stops and wont change dates, months or years

    Any ideas why this is happening?

    Thanks in advance for any help with this.

    Ortz

  7. #7
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,720

    Re: using a Calendar with multiple sheets.

    Sorry to take so long to reply. Can you attach your latest version? I am going to have to trace it down.

+ 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. Replies: 0
    Last Post: 05-23-2013, 04:39 PM
  2. Merge multiple excels with multiple sheets in a master excel with multiple sheets
    By marchi in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-15-2012, 10:37 AM
  3. Replies: 5
    Last Post: 11-04-2010, 06:02 AM
  4. Calendar Control Macro and Protected Sheets
    By Salmerin in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-07-2006, 07:51 PM
  5. time sheets:match a calendar
    By emmy in forum Excel General
    Replies: 1
    Last Post: 03-22-2006, 11:55 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