Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
checking for hidden columns
I want to create a macro that will validate whether a column is hidden or
not. I can make column hidden and/or unhide columns, but it is redudant if they are already in the state that I need them. Thank you for any and all input. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
checking for hidden columns
I don't think you need a macro to do that, just do:
If Not Columns(iCol).EntireRow.Hidden Then Columns(iCol).EntireRow.Hidden = True End If But even that I quit doing long ago. Except in cases of heavy computation where it's best to check first if something needs to be done, I've found it's simpler just to do Columns(iCol).EntireRow.Hidden = True and not worry about if it is already hidden. The above statement uses so little CPU time it's irrelevant whether or not it's already hidden. "stickandrock" wrote: I want to create a macro that will validate whether a column is hidden or not. I can make column hidden and/or unhide columns, but it is redudant if they are already in the state that I need them. Thank you for any and all input. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
checking for hidden columns
try,
Sub test() 'True=hide MsgBox checkColumnshide(3) End Sub Function checkColumnshide(i As Integer) As Boolean checkColumnshide = Columns(i).Hidden = True End Function -- 天行健,君*以自強不息 地勢坤,君*以厚德載物 http://www.vba.com.tw/plog/ "stickandrock" wrote: I want to create a macro that will validate whether a column is hidden or not. I can make column hidden and/or unhide columns, but it is redudant if they are already in the state that I need them. Thank you for any and all input. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
checking for hidden columns
Sorry about the mix up between columns and rows. I cut, pasted, and modified
on the fly. Columns(iCol).EntireColumn.Hidden "Charlie" wrote: I don't think you need a macro to do that, just do: If Not Columns(iCol).EntireRow.Hidden Then Columns(iCol).EntireRow.Hidden = True End If But even that I quit doing long ago. Except in cases of heavy computation where it's best to check first if something needs to be done, I've found it's simpler just to do Columns(iCol).EntireRow.Hidden = True and not worry about if it is already hidden. The above statement uses so little CPU time it's irrelevant whether or not it's already hidden. "stickandrock" wrote: I want to create a macro that will validate whether a column is hidden or not. I can make column hidden and/or unhide columns, but it is redudant if they are already in the state that I need them. Thank you for any and all input. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
checking for hidden columns
What about if a column or row is grouped?
|
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
checking for hidden columns
If you mean hiding/unhiding an individual row or column in a group, no
problem. You can do that. But if you mean hiding/unhiding all rows/columns in a group at once, much like clicking the grouping buttons...good question! I was unable to figure out how to do that. Anyone else have any ideas? (We are using Excel 2002.) "Mikerosoft" wrote: What about if a column or row is grouped? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
2007 Worksheet, Hidden Columns, .CSV Format Saves Hidden Column Da | Excel Discussion (Misc queries) | |||
Copy and Paste with hidden columns remaining hidden | Excel Discussion (Misc queries) | |||
Hidden rows columns won't stay hidden | Excel Worksheet Functions | |||
Hidden Columns No Longer Hidden after Copying Worksheet? | Excel Discussion (Misc queries) | |||
How to keep hidden columns hidden using protection | Excel Discussion (Misc queries) |