Hide Blank Columns
Closed
                                    
                        Jack                    
                                    -
                            Feb 15, 2011 at 02:49 PM
                        
venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 - Feb 16, 2011 at 01:05 AM
        venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 - Feb 16, 2011 at 01:05 AM
        Related:         
- Hide Blank Columns
 - Tweetdeck larger columns - Guide
 - Steam hide comments - Guide
 - Platinum hide ip - Download - VPN
 - Potplayer hide controls - Guide
 - Quicktime hide controls - Guide
 
1 response
                
        
                    venkat1926
    
        
                    Posts
            
                
            1863
                
                            Registration date
            Sunday June 14, 2009
                            Status
            Contributor
                            Last seen
            August  7, 2021
            
            
                    811
    
    
                    
Feb 16, 2011 at 01:05 AM
    Feb 16, 2011 at 01:05 AM
                        
                    modified macro is given below
in cells property the first argument is row no. and second argument is column no.
you have reversed
hidden=true is enough.
hidden =false is not necessary
It is a good prctise that in the macro design stage you can have message boxes to check whether macro is ding what you want. once macro is tested you can convert the msgbox statements as comment by putting a single apostrophe in the beginning of the statement.
            in cells property the first argument is row no. and second argument is column no.
you have reversed
hidden=true is enough.
hidden =false is not necessary
It is a good prctise that in the macro design stage you can have message boxes to check whether macro is ding what you want. once macro is tested you can convert the msgbox statements as comment by putting a single apostrophe in the beginning of the statement.
Sub HideColumns() Dim begincol As Integer, endcol As Integer, chkrow As Integer Dim colcnt As Integer begincol = 2 endcol = 7 chkrow = 9 For colcnt = begincol To endcol MsgBox colcnt 'If Cells(colcnt, chkrow).Value = "" Then If Cells(chkrow, colcnt) = "" Then Cells(chkrow, colcnt).EntireColumn.Hidden = True 'Cells(colcnt, chkrow).EntireColumn.Hidden = True 'Else 'Cells(colcnt, chkrow).EntireColumn.Hidden = False End If Next colcnt End Sub