+ Reply to Thread
Results 1 to 8 of 8

Macro for Message Popup

  1. #1
    Registered User
    Join Date
    10-20-2010
    Location
    San Francisco, California
    MS-Off Ver
    Excel 2010
    Posts
    13

    Macro for Message Popup

    Hello,
    I'm developing a register for a hostel, given two set of dates (check-in and check-out), i need to have a message popup whenever the stay is exceeded by 3 weeks.I would really appreciate if you could help me out with this one:

    Please See DEMO File.

    Please Login or Register  to view this content.

    Except D2,E2,F2 are all columns with 54 rows, so when the user enters the check-in date and check-out date, D2, E2, F2 are computed and the macro should immediately alert the user if the above conditions are met.I'm really new to VBA, if you could code the macro for me that would be great.

    Thanks
    AV
    Attached Files Attached Files
    Last edited by bngguy; 10-29-2010 at 02:19 PM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Macro for Message Popup

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    10-20-2010
    Location
    San Francisco, California
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Macro for Message Popup

    anybody???

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Macro for Message Popup

    How about in G2 and copy down,

    =IF(C2-B2>21, "Stay cannot exceed 3 weeks", "")
    Entia non sunt multiplicanda sine necessitate

  5. #5
    Registered User
    Join Date
    10-20-2010
    Location
    San Francisco, California
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Macro for Message Popup

    Well i was thinking about having a Message Box that popsup when the duration of stay exceeds 3 weeks.

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Macro for Message Popup

    Shg's formula or Conditional Formatting is the best option. There's no point using VBA when Excel has inbuilt features that work, the most obvious reason is that if macros aren't enabled then a VBA solution cannot work

  7. #7
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Macro for Message Popup

    If you're not using Data Validation on B & C already then you could consider using a Custom Validation Rule - see attached
    (with additional test in D:F calculations)

    (note: my question re: week calculation still holds - why is 1-Oct to 29-Oct 3 weeks 5 weekdays and 2 nights rather than 4 weeks ?)
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    10-20-2010
    Location
    San Francisco, California
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Macro for Message Popup

    Thanks for your response, well you are right 1-Oct to 29-Oct is 4 weeks, i guess i will go with Conditional Formatting for now.Thanks again for all the help.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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