+ Reply to Thread
Results 1 to 7 of 7

Excel VBA to generate pop-warning

  1. #1
    Registered User
    Join Date
    07-26-2023
    Location
    Virginia, USA
    MS-Off Ver
    Microsoft 365
    Posts
    3

    Excel VBA to generate pop-warning

    I am trying to creat a pop-up warning via VBA in the attached file.

    In the attached file,

    If the type is "training" and Team is selected, show a pop-up warning to leave the Team blank

    If the type is "work" and the team column is blank, show a pop-up warning to select the Team

    highlighted cells are incorrect in this example
    Attached Files Attached Files

  2. #2
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Excel VBA to generate pop-warning

    Hi kebede,

    When should the pop up show up? is the Team column supposed to be filled first, and then if Type does not match, the warning comes up? Easy to give a message, the question is what is the filling order, and what triggers the check.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  3. #3
    Registered User
    Join Date
    07-26-2023
    Location
    Virginia, USA
    MS-Off Ver
    Microsoft 365
    Posts
    3

    Re: Excel VBA to generate pop-warning

    yes, the Team column is supposed to be filled first. so, if Test 3 selected "Marketing" and picked "training"-there should be a warning. and If Test 4 left the team blank and selected anything but "training", there should be a warning. in other words, the Team column should remain blank, every time a test/employee is training and filled in if working.


    Employee Team Type
    Test 3 Marketing training
    Test 4 work

  4. #4
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Excel VBA to generate pop-warning

    In the VBA editor, double click on Sheet1 in the project window, and add this code:

    Please Login or Register  to view this content.
    Or I've attached your file with the modifications.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    07-26-2023
    Location
    Virginia, USA
    MS-Off Ver
    Microsoft 365
    Posts
    3

    Re: Excel VBA to generate pop-warning

    Hey Arkadi, thank you so much for your help on this.

    When I delete filled in cells, I get the "Run-time error '13':

    How do I prevent that when the cell value is cleared?
    Last edited by kebede; 07-27-2023 at 02:04 PM.

  6. #6
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Excel VBA to generate pop-warning

    Not sure you can detect that it is a deletion... and this solution would also mask other issues, but in theory at least this will ignore the error (whatever it is)

    Please Login or Register  to view this content.

  7. #7
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Excel VBA to generate pop-warning

    Better option:

    Please Login or Register  to view this content.

+ 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: 1
    Last Post: 02-16-2016, 07:51 PM
  2. Macros work perfectly in Excel 2010 but generate some errors in Excel 2013
    By Mumps1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-17-2015, 12:45 PM
  3. Excel tool to maintain database and generate word document through excel
    By ppganesh in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-12-2015, 03:58 AM
  4. Using Date in Cell to Generate Status with Overdue, or 30/60 Day Warning
    By Sara S in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 07-11-2015, 02:56 PM
  5. Run Macro to generate report in Access from excel data, then print PDF from Excel?
    By Danimarie in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-20-2012, 07:50 AM
  6. Generate warning if values not met
    By suma in forum Excel General
    Replies: 0
    Last Post: 01-05-2012, 03:54 PM
  7. generate a random number and use if function to generate new data
    By Dogdoc1142 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-25-2006, 10:50 PM

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