+ Reply to Thread
Results 1 to 5 of 5

Coding for Deleting cells without selecting them

  1. #1
    Forum Contributor
    Join Date
    09-11-2013
    Location
    Huntsville, AL
    MS-Off Ver
    Excel 2007
    Posts
    180

    Coding for Deleting cells without selecting them

    Please Login or Register  to view this content.
    HI,

    Above is the code that I am trying to enhance so I don't have to select the actual range to delete it. I am having a hard time figuring out how to do that. In this case, where Range("PO Check") (think open ended number of records within an ever changing range) = 0 then delete that entire row. Can you help me out?

    Thanks,

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Coding for Deleting cells without selecting them

    Hi,

    Presumably (if within the With .Worksheets(strDataWorksheet) )block

    Please Login or Register  to view this content.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Contributor
    Join Date
    09-11-2013
    Location
    Huntsville, AL
    MS-Off Ver
    Excel 2007
    Posts
    180

    Re: Coding for Deleting cells without selecting them

    Thank you! That worked exactly the way I had hoped. I hope this is not a stupid question, but the command implies that the entire range is deleted. I know I previously filtered it. Is there a way to know what the rule is regarding how Excel understands the command?

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Coding for Deleting cells without selecting them

    Hi,

    Yes you are quite correct. As written it ignores any filtering and will delete all rows in the range whether they are hidden or not.
    If you want it to operate on a filtered range and only delete the rows that are visible then modify it to:

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    09-11-2013
    Location
    Huntsville, AL
    MS-Off Ver
    Excel 2007
    Posts
    180

    Re: Coding for Deleting cells without selecting them

    Thank you!

+ 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] Code for Selecting and Deleting Certain Value
    By Grabaka in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-27-2013, 09:41 AM
  2. Selecting and deleting unprotected cells
    By mustanggt in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-11-2007, 06:06 AM
  3. Selecting and deleting records
    By bbig80524 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-10-2006, 02:09 PM
  4. [SOLVED] More Selecting and Deleting
    By bodhisatvaofboogie in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-15-2006, 10:40 AM
  5. Selecting AND Deleting
    By bodhisatvaofboogie in forum Excel General
    Replies: 11
    Last Post: 05-24-2006, 08:25 AM

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