+ Reply to Thread
Results 1 to 4 of 4

Excel: Add Data to the Table after hitting the Add Record Button

  1. #1
    Registered User
    Join Date
    09-07-2011
    Location
    Los Angeles, California
    MS-Off Ver
    Excel 2010
    Posts
    34

    Excel: Add Data to the Table after hitting the Add Record Button

    I'm new to recording Macros and I need help in writing VBA code to do the following:

    I have 2 different areas in my excel. The first part is where data is being keyed and the 2nd part is the table where I want the keyed data moved over to the next available row once "Add Record" button has been clicked.

    Attachment 840136Screenshot.jpgTPE_MacroEnabled.xlsm
    Last edited by ghiegomez; 08-19-2023 at 03:14 PM.

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,612

    Re: Excel: Add Data to the Table after hitting the Add Record Button

    Please Login or Register  to view this content.
    Named ranges for new record input cells:
    DATA.SOURCE ='TPE Report'!$E$11
    DATA.TYPE ='TPE Report'!$E$9
    DateRange ='TPE Report'!$E$13
    New.County ='TPE Report'!$C$13
    New.FIPS ='TPE Report'!$C$9
    New.State ='TPE Report'!$C$11

    No reason for empty rows in the table...
    Last edited by protonLeah; 08-19-2023 at 05:56 PM.
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    09-07-2011
    Location
    Los Angeles, California
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: Excel: Add Data to the Table after hitting the Add Record Button

    This gave me a runtime error

    Set TPE_Records = TPE_Report.ListObjects.Item("table2")

    Also, what do you mean by this?

    Named ranges for new record input cells:
    DATA.SOURCE ='TPE Report'!$E$11
    DATA.TYPE ='TPE Report'!$E$9
    DateRange ='TPE Report'!$E$13
    New.County ='TPE Report'!$C$13
    New.FIPS ='TPE Report'!$C$9
    New.State ='TPE Report'!$C$11

  4. #4
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,612

    Re: Excel: Add Data to the Table after hitting the Add Record Button

    You have a data entry form in rows 9,11 & 13. I just gave each cell a name, i.e., cell C9 is named New.FIPS., etc.
    For the runtime error, is your actual table named Table2?
    Attached Files Attached Files

+ 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. [SOLVED] How to insert Previous, Next Button & Print Record Button in excel???
    By vijubhau in forum Excel General
    Replies: 3
    Last Post: 10-24-2018, 07:01 AM
  2. Replies: 7
    Last Post: 04-13-2018, 07:38 PM
  3. [SOLVED] Data not showing up in worksheet when hitting save(add) button when runnin macro
    By Mik10 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-05-2016, 11:37 PM
  4. [SOLVED] Inserting data into the next row when hitting the submit button
    By jamalfried in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-01-2013, 05:05 PM
  5. [SOLVED] How to: copy data from sheet 1 to 2 after hitting a submit button?
    By WillGe in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-12-2012, 01:29 AM
  6. Replies: 1
    Last Post: 01-17-2012, 10:47 AM
  7. [SOLVED] Have to keep hitting the Continue Button
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-23-2006, 07:45 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