none
Excel Error Message RRS feed

  • Question

  • So it's not exactly an error message i'm looking for, but a pop up message (an alert) that comes up when a scenario happens in the spread sheet. So I've made a schedule with dates and times. Let's say this: three deliveries on sunday, one at 9, another at 9, and one at 11. Next to these deliveries are three little command buttons: "Truck 1", "Truck 2", and "Truck 3". For the 9 o'clock deliver, i want truck one to deliver it, so i will click "truck 1". For the second 9 o clock delivery, let's say i clicked "truck 1" again- i want an error message to pop up on the Sunday Form that says "truck one is already delivering. do you want to change it?" with a "YES or NO" answer. Anyone know how to make this happen??
    Sunday, June 12, 2016 4:59 AM

Answers

  • >>>For the 9 o'clock deliver, i want truck one to deliver it, so i will click "truck 1". For the second 9 o clock delivery, let's say i clicked "truck 1" again

    According to your description, you could create one hide sheet, then write and read data from it, refer to below code and modify with your requirement:

    Sub Demo()
    
     Set hidesheet = ActiveWorkbook.Sheets("TruckData")
     
     If Not hidesheet Is Nothing Then
     
       MsgBox hidesheet.Range("A1")
       
     Else
       Set hidesheet = ActiveWorkbook.Sheets.Add()
       hidesheet.Name = "TruckData"
       hidesheet.Visible = False
       
       hidesheet.Range("A1") = "Truck 1"
     End If
    
    End Sub

    >>>i want an error message to pop up on the Sunday Form that says "truck one is already delivering. do you want to change it?" with a "YES or NO" answer. 

    You could use MsgBox with buttons optional.

    MsgBox "Your message", vbYesNo, "Your MsgBox Title"

    For more information, click here to refer about MsgBox Function




    Tuesday, June 14, 2016 2:03 AM

All replies

  • Hi davidsjw,

    Based on your description, I will move you problem to MSDN forum for Excel:

    https://social.msdn.microsoft.com/Forums/en-US/home?forum=exceldev

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.


    Regards,

    Emi Zhang
    TechNet Community Support


    Please mark the reply as an answer if you find it is helpful.

    If you have feedback for TechNet Support, contact tnmff@microsoft.com.

    Monday, June 13, 2016 8:44 AM
  • >>>For the 9 o'clock deliver, i want truck one to deliver it, so i will click "truck 1". For the second 9 o clock delivery, let's say i clicked "truck 1" again

    According to your description, you could create one hide sheet, then write and read data from it, refer to below code and modify with your requirement:

    Sub Demo()
    
     Set hidesheet = ActiveWorkbook.Sheets("TruckData")
     
     If Not hidesheet Is Nothing Then
     
       MsgBox hidesheet.Range("A1")
       
     Else
       Set hidesheet = ActiveWorkbook.Sheets.Add()
       hidesheet.Name = "TruckData"
       hidesheet.Visible = False
       
       hidesheet.Range("A1") = "Truck 1"
     End If
    
    End Sub

    >>>i want an error message to pop up on the Sunday Form that says "truck one is already delivering. do you want to change it?" with a "YES or NO" answer. 

    You could use MsgBox with buttons optional.

    MsgBox "Your message", vbYesNo, "Your MsgBox Title"

    For more information, click here to refer about MsgBox Function




    Tuesday, June 14, 2016 2:03 AM