+ Reply to Thread
Results 1 to 6 of 6

This code not deleting entire row

  1. #1
    Forum Contributor
    Join Date
    12-11-2009
    Location
    Toronto
    MS-Off Ver
    Excel 2010
    Posts
    517

    This code not deleting entire row

    Hi, i have this code and its only clearing the data in column A. All i want is to find blank cell in column A and clear 10 ROWs after that blank cell. Should clear columns A B C D E & F. Thank you.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: This code not deleting entire row

    Please Login or Register  to view this content.

    OR

    Please Login or Register  to view this content.
    Last edited by AB33; 04-20-2015 at 10:14 AM.

  3. #3
    Forum Contributor
    Join Date
    04-15-2015
    Location
    beirut
    MS-Off Ver
    2010
    Posts
    107

    Re: This code not deleting entire row

    the correct code
    Sheets("Input").Range("A" & LastRow - 7 & ":" & "F" & LastRow).Resize(9).EntireRow.delete

  4. #4
    Forum Contributor
    Join Date
    12-11-2009
    Location
    Toronto
    MS-Off Ver
    Excel 2010
    Posts
    517

    Re: This code not deleting entire row

    Quote Originally Posted by AB33 View Post
    Please Login or Register  to view this content.

    OR

    Please Login or Register  to view this content.
    Hey AB33, that worked great but when there is no data and i run the macro, why do i get error message 'application defined or oject defined error'?

  5. #5
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: This code not deleting entire row

    It is because of this line
    LastRow - 7
    By default if a sheet is blank, you get the last row as 1, so you can not deduct 1 from 7. Your last row should be a minimum of 8 rows.

    Please Login or Register  to view this content.
    Last edited by AB33; 04-20-2015 at 10:25 AM.

  6. #6
    Forum Contributor
    Join Date
    12-11-2009
    Location
    Toronto
    MS-Off Ver
    Excel 2010
    Posts
    517

    Re: This code not deleting entire row

    Thanks guys

+ 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] Deleting entire row on condition
    By Andrew.Trevayne in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-06-2013, 06:23 AM
  2. Changing the syntax of working code fr deleting entire row to a cut/paste into another ws
    By kmarshall6576 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-02-2013, 03:00 PM
  3. Deleting entire row if value in column A = 0
    By pyufak in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-07-2009, 05:43 PM
  4. Deleting entire row.
    By mangesh in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-07-2006, 04:37 PM
  5. Deleting Entire Rows
    By gavsta in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-19-2005, 12:45 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