+ Reply to Thread
Results 1 to 3 of 3

Help with Message Box

  1. #1
    Registered User
    Join Date
    06-26-2014
    Location
    Scotland
    MS-Off Ver
    10
    Posts
    37

    Help with Message Box

    I have used this code to show a message box if a certain employee has less than 12 hours rest which works if I enter the values in manually, but column G is a result of a formula from E and F. I am not sure how to set it up so that when I enter the times in E and F, column G will change automatically and the box will flag up.

    Thanks for any help

    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim rng As Range
    Set rng = Target.Parent.Range("G5:G1000")
    If Target.Count > 1 Then Exit Sub
    If Intersect(Target, rng) Is Nothing Then Exit Sub
    Application.EnableEvents = False
    Select Case Target.Value
    Case Is < 12
    MsgBox (Range("E1") + " has less than 12 hours rest"), vbQuestion + vbOKCancel, "Exceedance"

    Case Else
    Target.Offset(, -1).Value = Target.Offset(, -1).Value + Target.Value
    End Select
    Application.EnableEvents = True
    End Sub

  2. #2
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Help with Message Box

    It seems you are doing more than just a message box? Why is there an addition to column F in the code?

    Try this, I have no idea what you wish to do with Case Else part though.

    Please Login or Register  to view this content.
    多么想要告诉你 我好喜欢你

  3. #3
    Registered User
    Join Date
    06-26-2014
    Location
    Scotland
    MS-Off Ver
    10
    Posts
    37

    Re: Help with Message Box

    Perfect !

    To be honest I am just starting out with macro
    I have been using other codes I have found online and altering them to suit my sheet. Some of this code might be pointless for what I am attempting to achieve but seems to work so ill just leave it until I am more experienced.

    Thanks so much for taking the time to help me with this

+ 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. Adding an input message to each cell to bring back corrsponding message
    By Nic31 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-01-2014, 09:28 AM
  2. [SOLVED] How to pop up a warning message before any Excel automatic update link reminder message
    By billj in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-01-2013, 10:41 AM
  3. Extracting mail message(outlook) table in the message body
    By andywsw in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-12-2012, 10:14 PM
  4. need of pop up message dynamically using data validation input message method
    By vba_life in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-09-2010, 09:03 AM
  5. [SOLVED] Intercept/replace standard 'cell protected' message with my own message?
    By KR in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-16-2006, 10:35 AM

Tags for this Thread

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