slyx

Problem with _Excel_RangeDelete

5 posts in this topic

I use Excel 2013. I use _Excel_RangeDelete to delete cells, but Excel always delete one row more.

For example: I try to delete "A4:F1000", but Excel always deletes "A3:F1000"

Thanks!

Local $iRows = $oSheetActive.UsedRange.Rows.Count
Local $sRange = "A4:" & "F" & $iRows
_Excel_RangeDelete($oSheetActive, $sRange)

 

Share this post


Link to post
Share on other sites



@slyx this is working just fine for me, deletes the expected rows. It is Excel 2016, but I can spin up a machine with 2013 to see if there is any difference, if this does not work for you.

#include <Excel.au3>

Local $oExcel = _Excel_Open()
Local $oWorkbook = _Excel_BookOpen($oExcel, @DesktopDir & "\Test.xlsx")

Local $iRows = $oWorkbook.ActiveSheet.UsedRange.Rows.Count
    ConsoleWrite($iRows & @CRLF) ;Prints 1000 as expected
Local $sRange = "A4:F" & $iRows
_Excel_RangeDelete($oWorkbook.ActiveSheet, $sRange) ;Deletes A4 through F1000 as expected

 


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Is A3 merged with A4?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

I don't think A3 is merged with A4 and just double checked.

Share this post


Link to post
Share on other sites

And double posted ;)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

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