+ Reply to Thread
Results 1 to 8 of 8

Deleting rows

  1. #1
    Registered User
    Join Date
    06-25-2014
    Location
    North Carolina
    MS-Off Ver
    2010
    Posts
    57

    Post Deleting rows

    I currently have a code that does not quite work correctly, I was hoping to get some help to get it running. What I want this code to do is to look only through column A and start at cell 13 and go down. I want it to delete any row that is blank, and I want it to keep every cell that has a word that starts with A,D,I ,P, and R and delete the entire row if its not, additionally delete any cell that has an exact match to "PRESS :" since it starts with P. I would also like to change the source sheet to a range of sheets, not all but a range. Any help would be appreciated!

    Please Login or Register  to view this content.

  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 rows

    What does it mean to "not quite work correctly"? Can you attach your file so that we can have your sample data to test with? To post a file:
    1. Under the text box where you type your reply click the Go Advanced button.
    2. In the next screen look above the reply box and click the "paper clip" icon. You will get a pop-up screen.
    3. In the pop-up, click Add then Select to select a file from your local drive
    4. Click the Upload button to upload the file
    5. Click Done to attach it.

    It will be displayed as an attachment underneath your post text. Alternatively as the last step you can click the Insert Inline button and a hyperlink to the file will be inserted directly into your post text in the spot where your cursor is set at the moment you click the button.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    06-25-2014
    Location
    North Carolina
    MS-Off Ver
    2010
    Posts
    57

    Re: Deleting rows

    The one that I have attached the code will delelte everything after cell 13.
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Deleting rows

    Based on your code, which lines are not supposed to be deleted?

  5. #5
    Registered User
    Join Date
    06-25-2014
    Location
    North Carolina
    MS-Off Ver
    2010
    Posts
    57

    Re: Deleting rows

    Looking in column A, if the word in the cell starts with an A,D,I,P,or R.

  6. #6
    Registered User
    Join Date
    06-12-2014
    Posts
    42

    Re: Deleting rows

    You're missing parenthesis and perhaps you want the = instead of <>?
    I think you're looking for:
    Please Login or Register  to view this content.
    Note that the entire condition is placed within parenthesis that open just after "Not"

  7. #7
    Registered User
    Join Date
    06-25-2014
    Location
    North Carolina
    MS-Off Ver
    2010
    Posts
    57

    Re: Deleting rows

    For that line of code I get a run time error 13: type mismatch?

  8. #8
    Registered User
    Join Date
    06-25-2014
    Location
    North Carolina
    MS-Off Ver
    2010
    Posts
    57

    Re: Deleting rows

    If i used () instead of [] the code worked, thank you!! just had one last question. If it would be possible to change the part of the code where I am setting the sourcesheet, if i could make that like range(sheet2:sheet25) unfortunately that doesnt work.

+ 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. Replies: 10
    Last Post: 06-07-2018, 04:16 PM
  2. Replies: 2
    Last Post: 08-20-2013, 07:52 AM
  3. Changing code from deleting rows to cut/paste rows into another sheet and delete blank row
    By kmarshall6576 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-18-2013, 01:54 AM
  4. [SOLVED] Deleting part of a column without deleting whole rows.
    By dstrdOne in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-30-2013, 11:42 AM
  5. VBA- deleting rows which contain cells that meet criteria, but skip alpha rows
    By cheapkid1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-30-2012, 08:49 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