WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

OLE with Excel
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Excel - Simple Conditional Column Hiding


ConditionalHideColumn.wbt
; Winbatch 2004F - simple conditional hiding of Excel columns
;                  based on range of totals
;
; Stan Littlefield, August 29, 2004
;/////////////////////////////////////////////////////////////////

cXLS = StrCat( dirScript(),"HIDECOL.XLS")
If ! FileExist(cXLS) Then Exit
oXL = ObjectOpen( "Excel.Application" )
oXL.Visible = @TRUE
oWK  = oXL.workbooks
oWK.open(cXLS)
oWS  = oXL.ActiveWorkBook.Sheets(1)
oWS.Activate()
cutoff = 9000    ; sample, should show only 2 columns of data

rng = oWS.Range("Totals") 
ForEach C In rng 
   If C.Value <= cutoff Then C.EntireColumn.Hidden = @True 
Next 

rng=0
oWS=0
oWK=0
oXL=0
Exit
 

Article ID:   W16608
File Created: 2005:02:18:12:21:36
Last Updated: 2005:02:18:12:21:36