+ Reply to Thread
Results 1 to 7 of 7

Deleting data and increasing a number by 1 when I hit the "Delete Button"

  1. #1
    Forum Contributor
    Join Date
    06-03-2009
    Location
    Phoenix, Az
    MS-Off Ver
    MS Office 365
    Posts
    144

    Deleting data and increasing a number by 1 when I hit the "Delete Button"

    Hello All -

    I am in need of assistance.

    I am trying to develop a macro that will not only delete data from the "Orders" tab, but will increase the number as shown in cell M3 (with a formula combining a few things in cell E3)

    What I have for the Deleting of data from the "Orders" tab is -
    Please Login or Register  to view this content.
    and the program to increase the number by 1 everytime is -
    Please Login or Register  to view this content.

    I would like to combine the two so that both happen with the same click of the "Delete Data" button.
    I know I am close, just can't figure it out.

    Any help would be appreciated.
    Thanks.
    Dave
    Attached Files Attached Files
    Last edited by davidingilbert; 08-05-2022 at 11:08 AM.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Deleting data and increasing a number by 1 when I hit the "Delete Button"

    Your code has macro recorder bloat. I have proposed a streamlined version, also combining as requested.

    Also, I strongly recommend to everyone that they use Option Explicit and declare variables. Doing so prevents a lot of bugs and runtime errors.

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Contributor
    Join Date
    06-03-2009
    Location
    Phoenix, Az
    MS-Off Ver
    MS Office 365
    Posts
    144

    Re: Deleting data and increasing a number by 1 when I hit the "Delete Button"

    Jeff - hot dang! It worked.
    Had to unmerge a cell but in the scheme of things, not a big deal!
    Sorry about the code thing. I had no idea....
    Thanks.
    dave

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Deleting data and increasing a number by 1 when I hit the "Delete Button"

    Glad to help! Nothing to apologize for, although because you are a member who's been here longer than me and with 125 posts I was obliged to flag it.

    I, and every other expert here, will recommend against using merged cells, and you have found one of the reasons. It is almost always possible to give the same format by using Horizontal > Center Across Selection. There are a small number of times when merged cells are the best solution, but that means that Excel might not be the right tool for the job.

  5. #5
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Deleting data and increasing a number by 1 when I hit the "Delete Button"

    If your question has been answered please mark your thread as "Solved" so that members will know by looking at the thread title that your problem is solved. Go to the menu immediately above your first post to the thread and click on Thread Tools. From the dropdown menu select "Mark this thread as solved..."

    If a member helped you solve your problem, consider adding to their reputation by clicking Add Reputation below their name.

    If you solved your own problem, please provide your solution so that somebody seeing this thread in a search for the same problem will see how it was solved.

  6. #6
    Valued Forum Contributor
    Join Date
    12-01-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2016
    Posts
    949

    Re: Deleting data and increasing a number by 1 when I hit the "Delete Button"

    just curious what kind of range is Data3[QUANTITY]
    Is that a cell address?

  7. #7
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Deleting data and increasing a number by 1 when I hit the "Delete Button"

    It is a structured table referenced. It means the data in table Data3 in the column labeled QUANTITY.

+ 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] Delete Cells with "0" Value is also deleting 0s within numbers string
    By Excelnewb1567 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-28-2019, 11:49 PM
  2. [SOLVED] Code to select "Delete" when deleting a tab within a Macro
    By sherylt13 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-06-2018, 11:17 PM
  3. [SOLVED] Best way to assign a "Bucket" to a "file number" based on data from row
    By BG1983 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-27-2016, 11:23 PM
  4. [SOLVED] Code that copies row of data to another sheet based on text "Complete"/"Delete"
    By Dremzy in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 04-20-2014, 05:51 PM
  5. Replies: 2
    Last Post: 04-20-2014, 11:18 AM
  6. Replies: 1
    Last Post: 10-23-2013, 05:20 PM
  7. VBA Code for deleting rows where cell in column a states "delete row"
    By tnfire in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-20-2009, 06:17 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