Results 1 to 6 of 6

Thread: Using userform VBA to create a list

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    VBAX Expert Logit's Avatar
    Joined
    Sep 2016
    Posts
    623
    Location
    Option Explicit
    Private Sub btnCancel_Click()
        Unload Me
    End Sub
    
    
    Private Sub btnOK_Click()
        Dim ws As Worksheet
        Set ws = ActiveSheet
        Dim newRow As Long
        
        newRow = Application.WorksheetFunction.CountA(ws.Range("A:A")) + 1
        
        'The next two lines can be expanded as many times as needed for all the entry fields in your project
        
        ws.Cells(newRow, 1).Value = Me.txtFirstName.Value
        ws.Cells(newRow, 2).Value = Me.txtSurname.Value
        
    End Sub
    Sub CommandButton1_Click()
        Selection.EntireRow.Delete
    End Sub
    Attached Files Attached Files

Posting Permissions

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