MoonGirl Posted October 3, 2021 Share Posted October 3, 2021 Hello everyone, I'm new to AutoIt scripting. I was wondering if someone could help me with my script? My table in Excel is this: DBN Description Amount 123 Some Text 13.00 I want to hide the columns that don't contain specified header text. $oRange = $oWorkbook1.ActiveSheet.Usedrange.SpecialCells($xlCellTypeVisible) If $oRange <> "DBN" Then $oRange.EntireColumn.Hidden = True Else $oRange.EntireColumn.Hidden = False EndIf Link to comment Share on other sites More sharing options...
Subz Posted October 4, 2021 Share Posted October 4, 2021 Use _Excel_RangeFind to find the address of the cell/column and then just use something like the following to hide the column. #include <Array.au3> #include <Excel.au3> Local $oExcel = _Excel_Open() Local $oWorkbook = _Excel_BookOpen($oExcel, "C:\Program Files (x86)\AutoIt3\Examples\Helpfile\Extras\_Excel1.xls") If @error Then _Excel_Close($oExcel) Exit EndIf Local $aResult = _Excel_RangeFind($oWorkbook, "This is a long Story", "A1:M1", Default, $xlWhole) For $i = UBound($aResult) - 1 To 0 Step - 1 $aSplit = StringSplit($aResult[$i][2], "$", 2) $oSelect = $oExcel.Columns($aSplit[1] & ":" & $aSplit[1]).Select $oExcel.Selection.EntireColumn.Hidden = True Next Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now