Results 1 to 11 of 11

Increment Variable from User Form Selection

Threaded View

jonhfl Increment Variable from User... 04-01-2010, 09:59 AM
davegugg Re: Increment Variable from... 04-01-2010, 10:29 AM
jonhfl Re: Increment Variable from... 04-01-2010, 10:31 AM
davegugg Re: Increment Variable from... 04-01-2010, 10:44 AM
jonhfl Re: Increment Variable from... 04-01-2010, 10:48 AM
jonhfl Re: Increment Variable from... 04-01-2010, 10:51 AM
davegugg Re: Increment Variable from... 04-01-2010, 10:54 AM
jonhfl Re: Increment Variable from... 04-01-2010, 10:58 AM
jonhfl Re: Increment Variable from... 04-01-2010, 11:03 AM
davegugg Re: Increment Variable from... 04-01-2010, 11:17 AM
jonhfl Re: Increment Variable from... 04-01-2010, 11:29 AM
  1. #5
    Registered User
    Join Date
    04-01-2010
    Location
    Orlando, FL
    MS-Off Ver
    Excel 2007
    Posts
    36

    Re: Increment Variable from User Form Selection

    Here is the code, I will try to break it out so you can see the steps....

    Dim Occ2Num as Integer - Occ2Num counts how many times Sheet("Model") is viewed
    Dim Occ3Num as Integer - Occ3Num counts how many times Sheet("Regional") is viewed
    
    Private Sub Workbook_Open()
    
    
        MainSelection.Show
    
    End Sub
    
    Private Sub RunComp_Click()
    
    Occ2Num = Occ2Num + 1
    
    Unload Me
    
    MsgBox ("To begin use the highlighted input cells to select a Base, Comp 1 and Comp 2 property.  Or see the Comp Chart to view comparable properties and make selections.")
    
    
    
    End Sub
    
    Private Sub RunReg_Click()
    
    Worksheets("Regional").Select
    Range("A1").Select
    
    Occ3Num = Occ3Num + 1
    
    Unload Me
    
    MsgBox ("To begin use the highlighted cells to select a Company, Region and Unit Size and then Press the 'Process Request' button.")
    
    MsgBox ("A property may have more than one unit type of a selected size.  Use the drop downs below the Association name to view other unit types of the same size.")
    
    
    End Sub
    
    At this point you are now in one of the two sheets.  The next two parts navigate from one sheet to the other once the workbook is loaded.
    
    Sub toregional()
    
        If Occ3Num = 0 Then
        Worksheets("Regional").Select
        Range("A1").Select
        
        MsgBox ("To begin use the highlighted cells to select a Company, Region and Unit Size and then Press the 'Process Request' button.")
        
        MsgBox ("A property may have more than one unit type of a selected size.  Use the drop downs below the Association name to view other unit types of the same size.")
    
        Occ3Num = Occ3Num + 1
    
        Else
        Worksheets("Regional").Select
        Range("A1").Select
        
        End If
        
    End Sub
    
    Sub tomodel()
    '
        If Occ2Num = 0 Then
        Sheets("Model").Select
        Range("A1").Select
            MsgBox ("To begin use the highlighted input cells to select a Base, Comp 1 and Comp 2 property.  Or see the Comp Chart to view comparable properties and make selections.")
        Occ2Num = Occ2Num + 1
        
        Else
        Sheets("Model").Select
        Range("A1").Select
        
        End If
        
    End Sub

    So it works perfect except for the fact that the one you select in the form will prompt again when navigated to via the macro. But it will only do it one more time.
    Last edited by jonhfl; 04-01-2010 at 10:56 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