+ Reply to Thread
Results 1 to 7 of 7

Code/Macro for deleting empty columns and rows.

  1. #1
    Registered User
    Join Date
    04-20-2011
    Location
    CA
    MS-Off Ver
    Excel 2003
    Posts
    44

    Code/Macro for deleting empty columns and rows.

    Hi,
    I have a report I get from a program. When i export this report into excel, it merges the cells and leaves empty rows. I can copy and paste special as text into another spreadsheet, that basically un-merges the cells however, leaves empty columns and rows. I need a code/macro to delete these blank rows and columns and give me a clean file that I can pivot. Please help.

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

    Re: Code/Macro for deleting empty columns and rows.

    Can you attach a sample workbook?

  3. #3
    Registered User
    Join Date
    04-20-2011
    Location
    CA
    MS-Off Ver
    Excel 2003
    Posts
    44

    Re: Code/Macro for deleting empty columns and rows.

    Sample.xlsxSure, John. Attached sample spreadsheet.

  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: Code/Macro for deleting empty columns and rows.

    Does this do what you want?

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    04-20-2011
    Location
    CA
    MS-Off Ver
    Excel 2003
    Posts
    44

    Re: Code/Macro for deleting empty columns and rows.

    Hi Thanks. yes it does for the most part. Except the Column A is left Blank. Can you please modify the code to delete the empty column A and start the text from Column A.

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

    Re: Code/Macro for deleting empty columns and rows.

    Try:

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    04-20-2011
    Location
    CA
    MS-Off Ver
    Excel 2003
    Posts
    44

    Re: Code/Macro for deleting empty columns and rows.

    Fantastic John. This works great. Thanks.
    I have another request. I get the Status of the Cases like "Open, Closed, Resolved, Pending, etc." in the rows. Please see the attached spreadsheet tab- "Current Report" in font red. Is there anyway the formula can look for these particular status (this could be in any cell) and then populate the last column with the header as "Status" and the respective status for each line. For example see the attached spreadsheet. The "Current Report" tab will show you what i have coming from the report. The "What i Need" tab shows all the unwanted empty columns and cells deleted and then the Status populated in red.
    Would help a lot if this can do this.
    Sample-2.xlsx
    Last edited by gautamacharya; 04-09-2014 at 01:52 PM.

+ 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 empty rows in excel using macro
    By nur2544 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-26-2013, 02:40 AM
  2. Deleting empty rows if specific cell in row is empty
    By csynic in forum Excel General
    Replies: 0
    Last Post: 07-06-2011, 01:43 AM
  3. Autofilter/delete empty rows is deleting non-empty rows!
    By oOarthurOo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-05-2010, 12:31 PM
  4. Deleting empty rows and columns
    By jannelee in forum Excel General
    Replies: 2
    Last Post: 06-20-2008, 07:16 PM
  5. Deleting empty rows and columns
    By JMye in forum Excel General
    Replies: 1
    Last Post: 06-20-2008, 01:46 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