+ Reply to Thread
Results 1 to 10 of 10

Delete record from table without deleting row

  1. #1
    Registered User
    Join Date
    03-05-2020
    Location
    Stoke on Trent, England
    MS-Off Ver
    Excel 2016
    Posts
    59

    Delete record from table without deleting row

    Hi Folks,

    I have a table in which I press a button to remove the last record using the code below:

    My issue is that I now have work to the right of the table which moves up when I delete an entry. Can the code be modified to just delete the last table entry and not the entire row? The button in the example is "DELETE LAST ROW"

    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    05-14-2020
    Location
    Mauritius
    MS-Off Ver
    Office 365
    Posts
    97

    Re: Delete record from table without deleting row

    Hello,

    take this:
    Please Login or Register  to view this content.
    instead of:
    Please Login or Register  to view this content.
    Greetings

    Tor


  3. #3
    Registered User
    Join Date
    03-05-2020
    Location
    Stoke on Trent, England
    MS-Off Ver
    Excel 2016
    Posts
    59

    Re: Delete record from table without deleting row

    Thanks for the reply.

    This doesn't do what I need. It removes the last row but then if I click it again it doesn't remove the new last row as the last row of the table is still present but without content.

    Also if I have data in cells to the right of the table then it will clear this too right?

    I need it to just remove the last row within the table and always be able to see what the last row is.

    The code I have posted does this perfectly it just deletes the whole row and not the table row only.

  4. #4
    Valued Forum Contributor
    Join Date
    11-04-2018
    Location
    Denpasar
    MS-Off Ver
    Excel 2010
    Posts
    777

    Re: Delete record from table without deleting row

    Maybe try this :
    Please Login or Register  to view this content.
    The code assumes that your table starts from column A to column C.
    So you need to adjust the "A" and the "offset(0,2)" in the code according to your table situation.
    Last edited by karmapala; 06-30-2020 at 06:21 AM.

  5. #5
    Registered User
    Join Date
    03-05-2020
    Location
    Stoke on Trent, England
    MS-Off Ver
    Excel 2016
    Posts
    59

    Re: Delete record from table without deleting row

    Thanks for the reply

    I cant get the code to work, code you put it in the example please.

  6. #6
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Delete record from table without deleting row

    Try this:
    Please Login or Register  to view this content.
    BSB

  7. #7
    Valued Forum Contributor
    Join Date
    11-04-2018
    Location
    Denpasar
    MS-Off Ver
    Excel 2010
    Posts
    777

    Re: Delete record from table without deleting row

    Please Login or Register  to view this content.
    The code is based on your table condition.
    Please try that on your workbook.

    2020-06-30_18-33-47.gif
    Last edited by karmapala; 06-30-2020 at 06:33 AM.

  8. #8
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,210

    Re: Delete record from table without deleting row

    Please Login or Register  to view this content.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  9. #9
    Registered User
    Join Date
    03-05-2020
    Location
    Stoke on Trent, England
    MS-Off Ver
    Excel 2016
    Posts
    59

    Re: Delete record from table without deleting row

    This code works great many thanks.

  10. #10
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Delete record from table without deleting row

    Glad we could help. Thanks for the Rep point

    BSB

+ 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. VBA help needed to delete ListBox selected record from table
    By krjoshi in forum Access Programming / VBA / Macros
    Replies: 2
    Last Post: 11-02-2016, 04:14 PM
  2. [SOLVED] When record is created/deleted in Table1, then add/delete record to Table2
    By michellepace in forum Excel General
    Replies: 1
    Last Post: 11-26-2015, 04:45 AM
  3. Deleting rows in table give me run time error delete method of range class failed
    By jhuvba in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-17-2015, 04:37 PM
  4. [SOLVED] Deleting all but one record from the same day
    By Debatewise in forum Excel General
    Replies: 3
    Last Post: 07-28-2013, 05:00 AM
  5. [SOLVED] Deleting a record in a table, using VBA
    By nav505 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 03-13-2013, 02:39 PM
  6. Replies: 1
    Last Post: 01-17-2012, 10:47 AM
  7. Can't delete a table without deleting the data?
    By JapanDave in forum Excel General
    Replies: 3
    Last Post: 07-08-2009, 03:46 AM

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