Results 1 to 7 of 7

Thread: VBA form question

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,888
    Location
    IF the fields are the same between disciplines, then I'd use a TabStrip control. IF NOT, then the logic can be adapted to a MultiPage control


    On CROWN & BRIDGE, the button runs the demo macro

    This is the userform code:


    Option Explicit
    
    
    Private Sub cbClose_Click()
        Me.Hide
        Unload Me
    End Sub
    
    
    Private Sub cbSave_Click()
        Dim wsToUpdate As Worksheet
        Dim rToUpdate As Range
        
        With Me
            Select Case .TabStrip1.Value  '   0 to 4
                Case 0
                    Set wsToUpdate = Worksheets("CROWN & BRIDGE")
                Case 1
                    Set wsToUpdate = Worksheets("ENDO")
                Case 2
                    Set wsToUpdate = Worksheets("GDP")
                Case 3
                    Set wsToUpdate = Worksheets("UNABLE TO FILL")
                Case 4
                    Set wsToUpdate = Worksheets("COMPLETE")
            End Select
        
            With wsToUpdate
                Set rToUpdate = .Cells(.Rows.Count, 1).End(xlUp).Offset(1, 0).EntireRow
            End With
            
            rToUpdate.Cells(1, 1).Value = .tbName.Value
            rToUpdate.Cells(1, 2).Value = .tbDate.Value
            rToUpdate.Cells(1, 3).Value = .tbTitle.Value
        
            'this clears the input
            .tbName.Value = vbNullString
            .tbDate.Value = vbNullString
            .tbTitle.Value = vbNullString
        End With
    
    
    End Sub
    Attached Files Attached Files
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

Posting Permissions

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