+ Reply to Thread
Results 1 to 10 of 10

Delete Row # based on cell value

  1. #1
    Forum Contributor stockgoblin42's Avatar
    Join Date
    05-26-2011
    Location
    vancouver, canada
    MS-Off Ver
    Excel 2010
    Posts
    222

    Delete Row # based on cell value

    Hi,

    I have a huge macro where I would like to include a line that deletes a row from a worksheet based upon the number in a cell on another worksheet. So, if the cell contains 23, then row 23 is deleted from another worksheet.

    What's the syntax for something like that.

    The cell is located on sheets "Intersect" at B16

    and the sheet I want a row deleted from is "Trim"

    any help is appreciated.

    Thanks
    live logic & long prosper

  2. #2
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127

    Re: Delete Row # based on cell value

    Something like:

    Please Login or Register  to view this content.

  3. #3
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Delete Row # based on cell value

    Hey StockGobllin,

    Be careful what you wish for. As I see this problem you are deleting Rows on your TRIM worksheet based on values in a INTERSECT worksheet.

    When you delete those rows on the TRIM sheet they will move up. If you run your macro twice it will keep deleting different rows with no connection between the two sheets. You should really give a sample workbook so we can see how you are going to delete your data before you implement this macro.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  4. #4
    Forum Contributor stockgoblin42's Avatar
    Join Date
    05-26-2011
    Location
    vancouver, canada
    MS-Off Ver
    Excel 2010
    Posts
    222

    Re: Delete Row # based on cell value

    thanks, i noticed some of my formulas changing, so I changed the DELETE to CLEARCONTENTS.

  5. #5
    Forum Contributor stockgoblin42's Avatar
    Join Date
    05-26-2011
    Location
    vancouver, canada
    MS-Off Ver
    Excel 2010
    Posts
    222

    Re: Delete Row # based on cell value

    I'd like to copy the line to a new sheet before I clear it but I'm having trouble with the following code, based on your line. Do you see what's wrong?

    Please Login or Register  to view this content.

  6. #6
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127

    Re: Delete Row # based on cell value

    This work?

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor stockgoblin42's Avatar
    Join Date
    05-26-2011
    Location
    vancouver, canada
    MS-Off Ver
    Excel 2010
    Posts
    222

    Re: Delete Row # based on cell value

    Unfortunately no, I get a type mismatch error on:

    Please Login or Register  to view this content.

  8. #8
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127

    Re: Delete Row # based on cell value

    Very odd. I just created a mock workbook with the same sheet names/ranges, and the macro worked fine. Is there any chance you can post a copy of the workbooks (if it contains confidential info, please replace it with similar, fictitious information)

  9. #9
    Forum Contributor stockgoblin42's Avatar
    Join Date
    05-26-2011
    Location
    vancouver, canada
    MS-Off Ver
    Excel 2010
    Posts
    222

    Re: Delete Row # based on cell value

    Damn, i had #N/A in the reference (B16) cell. So sorry. It works! Thanks for all your help.

  10. #10
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127

    Re: Delete Row # based on cell value

    No problem! Good luck

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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