+ Reply to Thread
Results 1 to 2 of 2

How to Simply Copy Form Field Data to a New Empty Row?

Hybrid View

  1. #1
    Valued Forum Contributor
    Join Date
    09-01-2013
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2010
    Posts
    324

    How to Simply Copy Form Field Data to a New Empty Row?

    Hello All,

    I am new to building forms in excel and right now its all confusing. Attached I have a work sheet layout out as a starting point.

    I have a form with 4 header sections:

    Cell A1: Date (Date Worked):
    Cell B1: Member ID Number:
    Cell C1: Work Type:
    Cell D1: Error:

    And each header has a form field aligned under it:

    Cell A2: Calendar Date Picker
    Cell B2: Text Field
    Cell C2: Combo Drop Down Selection (Cancellation, MAG, PCR, COCC, LOM)
    Cell D2: Combo Drop Down Selection (Yes, No)
    Cell E2: Submit Button


    I need a Macro to assign to the Submit button that will:
    1. Will take the info entered into the form fields and paste them in the same order of cells A,B,C,D starting on row 4.
    2. Will check if data has already been entered on a row and if so paste to the next row.
    3. Will reset the form fields once the data has been submitted.
    4. Save the worksheet without confirmation.

    I have also created an example row on line 4 as of what the output would look like. Thanks in advance for all your help.

    playaller_form_example.xlsm

  2. #2
    Valued Forum Contributor
    Join Date
    09-01-2013
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2010
    Posts
    324

    Re: How to Simply Copy Form Field Data to a New Empty Row?

    So after some googling, I just created a user form with the below code.

    Private Sub cmdProcess_Click()
    
     Dim rw As Long    'next available row
     
       With Sheets("Sheet2")
     
          'get the next avialable row in Sheet1
          rw = .Range("A" & .Rows.Count).End(xlUp).Row + 1
     
          'put the text box values in this row
          .Range("A" & rw).Value = txtDate.Value
          .Range("B" & rw).Value = txtID.Value
          .Range("C" & rw).Value = txtType.Value
          .Range("D" & rw).Value = txtError.Value
     
          'copy the formula from the previous row
          '.Range("C" & rw - 1 & ":G" & rw - 1).Copy
          '.Range("C" & rw & ":G" & rw).PasteSpecial Paste:=xlPasteFormulas
          'Application.CutCopyMode = False
       End With
     
       '================================
       'OPTIONAL - clear the text boxes
       '================================
       'txtName.Value = ""
       'txtAge.Value = ""
     
       '==========================
       'OPTIONAL - unload the form
       '==========================
       'unload me
    
    End Sub

    [All Solved Now]
    Last edited by playaller; 10-03-2013 at 06:15 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Copy Data from form field and paste into worksheet cell
    By azhark in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-18-2013, 04:47 PM
  2. [SOLVED] Copy from excel to field form
    By abjac in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-26-2013, 04:22 AM
  3. Macro to simply copy text from a cell.
    By thomasreiter in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-15-2013, 01:00 PM
  4. [SOLVED] Copy form field value to another form (calendar)
    By stylazyn@yahoo.com in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-01-2005, 06:00 PM
  5. VBA programming: Simply trying to select cell-- or not so simply?
    By whiteliyl_111 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-10-2005, 01:18 PM

Tags for this Thread

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