+ Reply to Thread
Results 1 to 5 of 5

Adapt code to delete row

  1. #1
    Registered User
    Join Date
    09-25-2011
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    45

    Adapt code to delete row

    Hi guys,

    I have a macro that merges and edits files from a folder. Part of the editing is that it will delete any blank rows if a cell in Column A is blank. It's worked fine till now as some of the files are not always populated and is inserted as a blank row.

    However, I've now had the situation where all the files have data in them, so there are no blank cells. So when I run the code I get a debug error.

    How can I adapt this code to check if there are blank cells in Column A and then delete the row? Or can I just use some error handling?

    Please Login or Register  to view this content.

  2. #2
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Adapt code to delete row

    Hi,

    You could use:

    Please Login or Register  to view this content.

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  3. #3
    Forum Contributor
    Join Date
    11-04-2011
    Location
    pak
    MS-Off Ver
    Excel 2007
    Posts
    132

    Re: Adapt code to delete row

    hello
    try this code:

    Please Login or Register  to view this content.
    Last edited by shaukat; 11-20-2011 at 06:24 AM.

  4. #4
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Adapt code to delete row

    @shaukat

    When you use looping to delete rows you always have to go through them backwards else you will end up missing some.

    Please Login or Register  to view this content.

    Dom
    Last edited by Domski; 11-20-2011 at 06:29 AM.

  5. #5
    Forum Contributor
    Join Date
    11-04-2011
    Location
    pak
    MS-Off Ver
    Excel 2007
    Posts
    132

    Re: Adapt code to delete row

    Thanks Domski. I am also very new to VB. I am learning from you people.

+ 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