+ Reply to Thread
Results 1 to 7 of 7

Insert row to existing table from userform data macro

  1. #1
    Registered User
    Join Date
    11-10-2013
    Location
    Michigan
    MS-Off Ver
    Excel 2010
    Posts
    4

    Insert row to existing table from userform data macro

    I'm trying to insert a row from a userform data and am having trouble getting the data in the right part of the table. My table is called tractors in the worksheet called tractors.
    Please Login or Register  to view this content.

    any help appreciated! thanks
    Last edited by Leith Ross; 11-10-2013 at 09:59 PM. Reason: Added Code Tags

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Insert row to existing table from userform data macro

    Hello akhalifa,

    Welcome to the Forum!

    This code should work. However, the line with "DayCab Or Sleeper" most likely will fail. The "OR" operator in VBA compares the results of 2 variables that evaluate to either true or false.
    You did not declare these variables in the macro nor explain what they are so there is no way for me to add the correct syntax to the macro.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

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

    Re: Insert row to existing table from userform data macro

    ........deleted.......
    Ben Van Johnson

  4. #4
    Registered User
    Join Date
    11-10-2013
    Location
    Michigan
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Insert row to existing table from userform data macro

    Nice, thanks Ross. Though is it possible to insert an entire new row rather than insert the data in next available row? I have another table below and I don't want them to overlap.

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Insert row to existing table from userform data macro

    Hello akhalifa,

    You can add a new row to the worksheet. Unless the new row intersects your table, you will have to resize the table rows yourself.

    Do want to add a new row below the last row of Table1, increase the table by one row, and then add the new data to the last row of the table?

  6. #6
    Registered User
    Join Date
    11-10-2013
    Location
    Michigan
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Insert row to existing table from userform data macro

    Could this be done in the code rather than manually? inserting a new row and new data in that row?

  7. #7
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Insert row to existing table from userform data macro

    Hello akhalifa,

    This should work...
    Please Login or Register  to view this content.

+ 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. Replies: 11
    Last Post: 11-04-2013, 04:32 PM
  2. Replies: 3
    Last Post: 10-14-2013, 03:06 PM
  3. macro to insert data table
    By a2424 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-04-2012, 11:27 PM
  4. [SOLVED] Userform Button to Add Data to an Existing Table
    By abysva in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-20-2012, 09:36 AM
  5. Userform to modify existing table
    By JDmacroman in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-24-2011, 10:02 PM

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