Results 1 to 7 of 7

Stop a Macro if Criteria not met and Show Error Message

Threaded View

  1. #1
    Registered User
    Join Date
    06-17-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    3

    Stop a Macro if Criteria not met and Show Error Message

    Hello!

    I'm fairly new to VBA and have a question, something probably quite simple to fix

    I am trying to work a simple Macro which looks at the item selected on a dropdown (through data validation) for acceptance of Terms and Conditions. If agreed, I want to unhide another tab, if disagree selected, then an error message should be shown and the tab should not be unhidden.

    I have managed to get the error message for disagree, however it still unhides the tab any advice here will be greatly appreciated.

    Private Sub Worksheet_Change(ByVal Target As Range)
        
        
        If (Range("B29") = "Agree") Then
    
    Sub unhide()
    
    '
    ' unhide Macro
    '
    
    '
        Sheets("Pricing Conditions").Select
        Sheets("Pricing Template").Visible = True
        Range("E17").Select
    
    If (Range("B29") <> "Agree") Then
    
    
    Errormsg:
        MsgBox "Please Read Conditions and Agree"
    
    Exit Sub
    
    End If
    End Sub
    Many thanks,
    Mez
    Last edited by m3hool; 06-17-2013 at 10:11 AM.

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