Jump to content

Recommended Posts

Posted

I recently >posted a question in the general help and support about how the best way to find the last non-empty cell in a workbook.  @Water was kind enough to help me find several solutions.  During that thread we also posted a snippet that I find to be very useful.  It was slightly off topic from the OP so I thought I would post it here so it has a home in case anyone needs it. That said, this is one way to delete all blank rows in a spreadsheet:

$oWorkbook.ActiveSheet.Columns("A:A").SpecialCells($xlCellTypeBlanks).EntireRow.Delete

The $xlCellTypeBlanks is a constant in the Excel constants include so you don't need to pre-define it.  "A:A" is the range.  So this would look for any blank rows in Col A and delete those rows from the workbook.

Hope somebody finds it useful. 

Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt

Posted

More special ranges can be found in the wiki for the Excel UDF.

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

Would you be able to provide a workable example?

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted

Sure,

#include<Excel.au3>
Local $oAppl = _Excel_Open()
Local $sWorkbook = @ScriptDir & "\test.xlsx" ; a workbook with some data and blank rows
Local $oWorkbook = _Excel_BookOpen($oAppl, $sWorkbook, Default, Default, True)
$oWorkbook.ActiveSheet.Columns("A:A").SpecialCells($xlCellTypeBlanks).EntireRow.Delete

The above is untested but should open a workbook and delete all blank rows.

Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...