Consulting

Results 1 to 5 of 5

Thread: Macro for drop down menu based message box

  1. #1
    VBAX Newbie
    Joined
    Dec 2013
    Posts
    5
    Location

    Macro for drop down menu based message box

    Friends,

    Good day to everyone !

    I need a macro code for the following problem.

    I have an excel sheet and on that I am using drop down menu in Cell U8 to U357 (Data Validation). In this work sheet, If I selected the value "A" from the drop down menu, I want to Display a message box with a message " Please enter the absent mode" and once the user clicked OK on the message box automatically the selection should go to its parallel "V" cell.

    Eg: As soon as I selected "A" from drop down menu in cell U10, the " Please enter the absent mode" message should appear with an OK button and after clicking the OK the cursor should select the "V10" Cell where the absent mode has to enter. I will be more happy if only the "V10" cell is active and the user can do anything in other cells Only after entering any value in the "V10" cell.

    Kindly help me with a macro for this and thanks in advance.

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Add this to the worksheet code module

    Private Sub Worksheet_Change(ByVal Target As Range)
    
        If Not Intersect(Target, Me.Range("U8:U357")) Is Nothing Then
        
            If Target.Value = "A" Then
            
                MsgBox "Please enter the absent mode", vbOKOnly
                Target.Offset(0, 1).Select
            End If
        End If
    End Sub
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Mentor
    Joined
    Feb 2009
    Posts
    493
    Location
    Aneshdas I notice that you crossposted at the below link. It appears a solution has been provided. I notice you haven't replied to xld. Can you please reply to both threads if this has now been solved.http://www.mrexcel.com/forum/excel-q...box.htmlThanks
    -----------------------------------------
    The more you learn about something the more you know you have much to learn.

  4. #4
    VBAX Newbie
    Joined
    Dec 2013
    Posts
    5
    Location
    Quote Originally Posted by xld View Post
    Add this to the worksheet code module

    Private Sub Worksheet_Change(ByVal Target As Range)
    
        If Not Intersect(Target, Me.Range("U8:U357")) Is Nothing Then
        
            If Target.Value = "A" Then
            
                MsgBox "Please enter the absent mode", vbOKOnly
                Target.Offset(0, 1).Select
            End If
        End If
    End Sub

    Thanks sir,

    But it has just selected the respective "V" cell only. I am using drop down menu on V cell also. I need to activate the V drop down menu as soon as I enter the "A" in U cell and click the OK in message box.

  5. #5
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Can you respond to BrianMH please, I think we deserve that courtesy.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •