Delete Blank rows in Range till last row with data

Hi All,

I am looking for code to delete Blank rows in range or worksheet till last row with data.

Any help or pointers would be much appreciated


If it’s a csv file, it’ll be easy.

gc c:\temp\abc.csv | foreach {
if($_.length -eq 0){
$_ | out-file C:\temp\abc_new.csv -Append




I have .xlsx file, I am working with. which has some graphs and charts associated with it.

Tried to use command which I have used with VBA code
its not working

$range = $WorkSheet.Range(“A4:AM206“).Range(“A:A”).SpecialCells(xlCellTypeBlanks).EntireRow.Delete