+ Reply to Thread
Results 1 to 18 of 18

iCell.EntireRow.Delete not working. Need code to Delete Entire Row

  1. #1
    Valued Forum Contributor unit285's Avatar
    Join Date
    10-29-2015
    Location
    TN
    MS-Off Ver
    Office 365
    Posts
    358

    iCell.EntireRow.Delete not working. Need code to Delete Entire Row

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    is not working for me.. but if I remove
    Please Login or Register  to view this content.
    then
    Please Login or Register  to view this content.
    works fine.. So confused by what is probably a simple fix I'm just not seeing Any help is appreciated!

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: iCell.EntireRow.Delete not working. Need code to Delete Entire Row

    How is it not working?

    What error message, if any, do you get if you remove On Error Resume Next?
    If posting code please use code tags, see here.

  3. #3
    Valued Forum Contributor unit285's Avatar
    Join Date
    10-29-2015
    Location
    TN
    MS-Off Ver
    Office 365
    Posts
    358

    Re: iCell.EntireRow.Delete not working. Need code to Delete Entire Row

    I don't get any error message.. the rows just do not get deleted

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: iCell.EntireRow.Delete not working. Need code to Delete Entire Row

    Any chance you could upload a sample workbook?

    Click on GO ADVANCED, scroll down and click Manage Attachments.

  5. #5
    Valued Forum Contributor unit285's Avatar
    Join Date
    10-29-2015
    Location
    TN
    MS-Off Ver
    Office 365
    Posts
    358

    Re: iCell.EntireRow.Delete not working. Need code to Delete Entire Row

    This is a copy of my file.. It is not nearly complete yet, and I am basically trying to sort thru data based on what is in the Search Textbox. Click the "Reports" button on the home page and then make sure the Checkbox beside "All" is checked. Then type "Guard" into the Search Textbox and click Generate. The code I am working on is located in the "Generate" command button module

    Here is a screenshot. http://prntscr.com/fcfp6b

    Put a ' in front of the
    Please Login or Register  to view this content.
    line in the code shown in the screenshot and you will see how it sorts the data with font color.. it just does not delete it
    Attached Files Attached Files
    Last edited by unit285; 05-26-2017 at 01:26 PM.

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: iCell.EntireRow.Delete not working. Need code to Delete Entire Row

    Why do you have Not here?
    Please Login or Register  to view this content.
    Surely you want to delete the row if InStr(iCell, UCase(Search)) > 0, ie the search value is found in the cell.

    Try dropping the Not, when I did rows were getting deleted.

    By the way, whenever you delete you should loop from the top to the bottom.

  7. #7
    Valued Forum Contributor unit285's Avatar
    Join Date
    10-29-2015
    Location
    TN
    MS-Off Ver
    Office 365
    Posts
    358

    Re: iCell.EntireRow.Delete not working. Need code to Delete Entire Row

    If the Search Term is located, I want to delete any rows that do NOT include the search term.

  8. #8
    Valued Forum Contributor unit285's Avatar
    Join Date
    10-29-2015
    Location
    TN
    MS-Off Ver
    Office 365
    Posts
    358

    Re: iCell.EntireRow.Delete not working. Need code to Delete Entire Row

    I'm not sure what you mean by looping from top to bottom.. Sorry I am not much of a vba expert.. I just meddle with it enough to get myself into trouble like this

  9. #9
    Valued Forum Contributor unit285's Avatar
    Join Date
    10-29-2015
    Location
    TN
    MS-Off Ver
    Office 365
    Posts
    358

    Re: iCell.EntireRow.Delete not working. Need code to Delete Entire Row

    The goal for the ufReport Userform is to search for criteria, so if there is a search term I want to located rows with that search term, if there is a MFR selected, then only show that MFR, price levels the same way.. basically it narrows down the data to just the rows I want to see

  10. #10
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: iCell.EntireRow.Delete not working. Need code to Delete Entire Row

    Why not test for =0?
    Please Login or Register  to view this content.

  11. #11
    Valued Forum Contributor unit285's Avatar
    Join Date
    10-29-2015
    Location
    TN
    MS-Off Ver
    Office 365
    Posts
    358

    Re: iCell.EntireRow.Delete not working. Need code to Delete Entire Row

    Yeah I could do that.. But that does not solve my main problem. I will come back thru the code later looking for ways to optimize it.. For now I would like to know why the line
    Please Login or Register  to view this content.
    is not working

  12. #12
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: iCell.EntireRow.Delete not working. Need code to Delete Entire Row

    It's nothing to do with optimizing the code, did you try what I suggested?

    As for why that line isn't deleting anything, are you sure it isn't? Have you checked if it's actually being executed?

  13. #13
    Valued Forum Contributor unit285's Avatar
    Join Date
    10-29-2015
    Location
    TN
    MS-Off Ver
    Office 365
    Posts
    358

    Re: iCell.EntireRow.Delete not working. Need code to Delete Entire Row

    I did try it. It made zero difference. Let me explain as simply as I can with these screenshots for reference.

    Step 1
    I enter "Guard" as a search term. My code looks like this: http://prntscr.com/fcgkga
    What should happen is any rows of data that do not include "Guard" should turn Red.
    Here are the results: http://prntscr.com/fcgl45

    Step 1 Results in a Success.

    Step 2
    I enter "Guard" as a search term. My code looks like this: http://prntscr.com/fcgkr4
    What should happen is any rows of data that do not include "Guard" should get deleted.
    Here are the results: http://prntscr.com/fcglm5

    Step 2 Results in a Failure.

    The only difference in the code between Step 1 and Step 2 are these, in Step 1 I used
    Please Login or Register  to view this content.
    And in Step 2 I used
    Please Login or Register  to view this content.

  14. #14
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: iCell.EntireRow.Delete not working. Need code to Delete Entire Row

    Which worksheet should the rows be deleted from?

    Is it 'Database' or the hidden worksheet 'Report285'?

  15. #15
    Valued Forum Contributor unit285's Avatar
    Join Date
    10-29-2015
    Location
    TN
    MS-Off Ver
    Office 365
    Posts
    358

    Re: iCell.EntireRow.Delete not working. Need code to Delete Entire Row

    Database should not get altered. Delete from Report285

  16. #16
    Valued Forum Contributor unit285's Avatar
    Join Date
    10-29-2015
    Location
    TN
    MS-Off Ver
    Office 365
    Posts
    358

    Re: iCell.EntireRow.Delete not working. Need code to Delete Entire Row

    The more I look at this code the more confounded I become. Why does EntireRow.Font.Color work and EntireRow.Delete not? It makes no sense. Wtf am I missing

  17. #17
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: iCell.EntireRow.Delete not working. Need code to Delete Entire Row

    Perhaps it's an idea to look at the rest of the code rather than concentrating on that specific line/section of code - there certainly seems to a few other things going on.

    What exactly, from start to finish, is the code meant to do?

  18. #18
    Valued Forum Contributor unit285's Avatar
    Join Date
    10-29-2015
    Location
    TN
    MS-Off Ver
    Office 365
    Posts
    358
    Quote Originally Posted by Norie View Post
    Perhaps it's an idea to look at the rest of the code rather than concentrating on that specific line/section of code - there certainly seems to a few other things going on.

    What exactly, from start to finish, is the code meant to do?
    The Database sheet contains data imported from my point of sale, specifically it lists power units my store has in stock. The Reports userform is designed to sort thru the database and find specific units based on the criteria entered. So the search textbox should allow me to search for a string in the description of each power unit. Maybe i want to search for Log splitters, or pressure washers, etc... the Reports285 sheet works as a buffer so data from the database never gets deleted. It's kind of a work in progress too.. so it may yet evolve into other functionalities etc...
    I am quite convinced that my code is structured as i want it. I tried a few other lines in place of [
    Please Login or Register  to view this content.
    such as
    Please Login or Register  to view this content.
    and it seems like they all work fine except for the delete line

+ 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 code to delete the FILTERED range and moving the cell up (dont Delete entire row)
    By mchilapur in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-14-2015, 07:48 AM
  2. [SOLVED] Entirerow.delete
    By Prexcel in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-17-2014, 09:16 PM
  3. [SOLVED] Simple delete entirerow if value vba not working....
    By rpinxt in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-06-2013, 05:10 AM
  4. CurrentRegion.EntireRow.Delete (+ the next row)
    By BBoydAnchor in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-28-2011, 04:16 PM
  5. How to fix cell.entirerow.delete?
    By guy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-09-2005, 11:06 PM
  6. [SOLVED] EntireRow.Delete
    By Steph in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 01-21-2005, 07:06 PM
  7. EntireRow.Delete Not what I want
    By spencermjax in forum Excel General
    Replies: 1
    Last Post: 01-14-2005, 11:40 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