Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 139
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default checking for hidden columns

What about if a column or row is grouped?



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default 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
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
2007 Worksheet, Hidden Columns, .CSV Format Saves Hidden Column Da Tammy Excel Discussion (Misc queries) 3 April 2nd 09 11:40 PM
Copy and Paste with hidden columns remaining hidden Pendelfin Excel Discussion (Misc queries) 2 February 26th 09 11:35 AM
Hidden rows columns won't stay hidden christie Excel Worksheet Functions 0 September 30th 08 05:44 PM
Hidden Columns No Longer Hidden after Copying Worksheet? EV Nelson Excel Discussion (Misc queries) 1 December 6th 06 05:10 PM
How to keep hidden columns hidden using protection Dave Excel Discussion (Misc queries) 1 March 1st 06 02:20 AM


All times are GMT +1. The time now is 09:31 AM.

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

About Us

"It's about Microsoft Excel"