+ Reply to Thread
Results 1 to 8 of 8

Exit all subs

Hybrid View

  1. #1
    Registered User
    Join Date
    08-14-2009
    Location
    Bristol, England
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Exit all subs

    ok thanks its working now

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Exit all subs

    Be careful of the use of End. It will reset all module/project level variables.

    The problem is that the response variable is local to the caller routine.
    You either need to use a public variable or a private variable within the userform that you can read.

    public variable approach.
    Public response As Integer
    Private Sub CommandButton1_Click()
        
        Dim click As Integer
    
        click = ActiveSheet.Range("Z1")
        
        click = click + 1
    
        ActiveSheet.Range("Z1") = click
        
        UserForm1.Show
        
        If response = 1 Then
            Exit Sub
        End If
            
        Call NotifyDepartments(click)
    
    End Sub
    Cheers
    Andy
    www.andypope.info

+ Reply to Thread

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