Jump to content

How to delete a column from excel file in excel 2013


Mian
 Share

Recommended Posts

If I am not wrong _Excel_RangeDelete() function is used to delete rows/columns/cells from the excel file. In the manual page there are examples of deleting range and rows but I found not a single example of deleting a whole column. I tried this _Excel_RangeDelete($oExcel, "1")  but no success. Please help.

Link to comment
Share on other sites

  • Moderators

Hi, @Mian welcome to the forum. The snippet below works just fine for me:

#include <Excel.au3>

Local $oExcel = _Excel_Open()
Local $oWorkbook = _Excel_BookOpen($oExcel, @ScriptDir & "\1.xls")
_Excel_RangeDelete($oWorkbook.ActiveSheet, "B:B", $xlShiftToLeft)

 

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

@JLogan3o13 Thank you for the solution. I used the following code to remove the column but I will update my code now ;)

;
; To remove the excluded column
;
send("^g") ; ^  is for CTRL
sleep(500)
WinWait("Go To")
sleep(500)
WinActivate("Go To")
sleep(500)
;send("R")
send("G1")
sleep(500)
Send("{TAB 3}")
sleep(500)
Send("{ENTER}")
sleep(500)
send("^{SPACE}")
sleep(500)
send("^-")
sleep(500)

 

Link to comment
Share on other sites

It is always a good idea to use the UDFs that come with Autoit to automate Office.
Automating the GUI might interfere with user actions, using COM (most of the time) does not.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

If you are talking aboutthen I have already added a comment.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

  • 5 years later...
  • Moderators

@benmartin9920 Did you not see that this thread is over 5 years old? Please STOP resurrecting old threads.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...