LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default Hide Column If Usedrange of Column ISBLANK Follow-up

Hello all,

I'm following up to my first post. I'm looking to loop through
columns looking at a range that varies in rows. I'm looking to hide
the columns with the range of rows that are blank or empty or
xlspecialcells. The range will be the active column, beginning with
row 12 to the last used cell in the column.

This code works for cycling through the columns but, it only looks at
one row. In this code it's looking at row 2. If .Cells(2, iCol). I
need it to look at cells from row 12 to the last used row and hide
columns that are blank in that range. Any assistance really
appreciated. As always thank you in advance, Ron

Option Explicit
Private Sub ToggleButton1_Click()

Dim iCol As Long

Dim iLastCol As Long

With Worksheets("2006 Realized Gains")

iLastCol = Cells.SpecialCells(xlCellTypeLastCell).Column
For iCol = 1 To iLastCol


If .Cells(2, iCol).Font.ColorIndex = 5 _
And .Cells(2, iCol).Interior.ColorIndex = 24 Then
.Columns(iCol).Hidden = ToggleButton1.Value
Else
.Columns(iCol).Hidden = False
End If
Next iCol


'this is just for looks when I'm done
Range("A1").Select


End With
End Sub


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hide Column If Usedrange of Column ISBLANK [email protected] Excel Discussion (Misc queries) 4 April 12th 09 09:47 PM
SORT a column of Texts to follow another "EXACT" order F. Lawrence Kulchar Excel Discussion (Misc queries) 6 September 17th 08 09:14 PM
Hide column or row based on a cell in the column or row? SacGuy Excel Discussion (Misc queries) 0 January 24th 06 06:51 PM
test if column isblank Spike Excel Worksheet Functions 3 November 29th 05 02:06 PM
hide column varun New Users to Excel 1 December 3rd 04 02:13 AM


All times are GMT +1. The time now is 02:13 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"