+ Reply to Thread
Results 1 to 2 of 2

Delete unused rows or limit worksheet to only filled in cells?

  1. #1
    Registered User
    Join Date
    07-31-2012
    Location
    California
    MS-Off Ver
    Excel 2003
    Posts
    31

    Delete unused rows or limit worksheet to only filled in cells?

    Hey folks, I have a macro that creates a new Workbook with all the information entered and saves it as a .txt file. Unfortunately the program that utilizes this TXT file doesn't like "Empty content lines." My macro copies only used rows but when I tried deleting used rows with code I could find on the net it still seems to generate many lines of empty lines in the TXT file. I must assume that it considers empty rows as somehow used among the many other lines of code that run. I have to manually delete the empty rows after Creating the TXT file which I don't mind, but if I can eliminate this step somehow for other users that is ideal.

    Alternatively, is there a way I can eradicate everything in the source spreadsheet except the used rows? Like limit the size of the worksheet before moving the data to the new worksheet?

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Delete unused rows or limit worksheet to only filled in cells?

    Hi, youngtusk87,

    have you tried using the Autofilter, show only the filled cells and the not use something like
    Please Login or Register  to view this content.
    but instead
    Please Login or Register  to view this content.
    You could use SpecialCells to delete the blanks in a column (use EntireRow if the whole row is to be deleted), you could use only the constants in that row and build a range on these rows and the UsedRange.

    Please mind that the use of SpecialCells will throw up an exception if no such cells are found so either make sure there are cells available or use an error handler like On Error Resume Next but be aware to set it back after the line with SpecialCells and check the err and decide to either go on with the code or end the macro.

    Ciao,
    Holger

+ 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