PC Review


Reply
Thread Tools Rate Thread

Detect Hidden Columns

 
 
=?Utf-8?B?R2VvZmY=?=
Guest
Posts: n/a
 
      22nd Mar 2007
How can I detect if any columns have been hidden on a worksheet in vba?

I would like to use this to prevent a modal form (called from wsheet1)
initialising and also in a Workbook_BeforeClose event which contains 4
wsheets.

Geoff
 
Reply With Quote
 
 
 
 
=?Utf-8?B?R2FyeScncyBTdHVkZW50?=
Guest
Posts: n/a
 
      22nd Mar 2007
Sub geoff()
For i = 1 To 256
If Columns(i).EntireColumn.Hidden = True Then
MsgBox ("column " & i & " is hidden")
End If
Next
End Sub
--
Gary''s Student
gsnu200711

 
Reply With Quote
 
=?Utf-8?B?R2VvZmY=?=
Guest
Posts: n/a
 
      22nd Mar 2007
Thank you, I can adapt from that.

Geoff

"Gary''s Student" wrote:

> Sub geoff()
> For i = 1 To 256
> If Columns(i).EntireColumn.Hidden = True Then
> MsgBox ("column " & i & " is hidden")
> End If
> Next
> End Sub
> --
> Gary''s Student
> gsnu200711
>

 
Reply With Quote
 
NickHK
Guest
Posts: n/a
 
      22nd Mar 2007
Given that people are using v2007 now, it would be better not to hard code
the row count:

Private Sub CommandButton1_Click()
Dim i As Long

With ActiveSheet.Columns
For i = 1 To .Count
If .Item(i).EntireColumn.Hidden = True Then
MsgBox "column " & i & " is hidden"
End If
Next
End With

End Sub

NickHK

"Gary''s Student" <(E-Mail Removed)> wrote in message
news:EA163D1A-0F72-4A45-849B-(E-Mail Removed)...
> Sub geoff()
> For i = 1 To 256
> If Columns(i).EntireColumn.Hidden = True Then
> MsgBox ("column " & i & " is hidden")
> End If
> Next
> End Sub
> --
> Gary''s Student
> gsnu200711
>



 
Reply With Quote
 
=?Utf-8?B?R2FyeScncyBTdHVkZW50?=
Guest
Posts: n/a
 
      22nd Mar 2007
good point.


b.t.w - what's an item ?
--
Gary''s Student
gsnu200711

 
Reply With Quote
 
NickHK
Guest
Posts: n/a
 
      22nd Mar 2007
Collections have a member of .Item.

..Columns(i) is equivalent to .Columns.Item(i)

Only so I could include both in the With block.

NickHK

"Gary''s Student" <(E-Mail Removed)> wrote in message
news:BE47585F-3A85-4F80-B9A3-(E-Mail Removed)...
> good point.
>
>
> b.t.w - what's an item ?
> --
> Gary''s Student
> gsnu200711
>



 
Reply With Quote
 
=?Utf-8?B?R2FyeScncyBTdHVkZW50?=
Guest
Posts: n/a
 
      22nd Mar 2007
thanks
--
Gary''s Student

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
2007 Worksheet, Hidden Columns, .CSV Format Saves Hidden Column Da Tammy Microsoft Excel Misc 3 2nd Apr 2009 11:40 PM
Detect Hidden Columns by Formula David Godinger Microsoft Excel Programming 5 9th Jan 2007 03:09 AM
Hidden Columns No Longer Hidden after Copying Worksheet? EV Nelson Microsoft Excel Misc 0 6th Dec 2006 04:25 PM
How do I detect hidden worksheets or hidden data on a worksheet? =?Utf-8?B?QWxpY2U=?= Microsoft Excel Misc 4 24th Aug 2006 03:38 AM
Keeping hidden columns HIDDEN in a copy-and-paste leojbramble Microsoft Excel Discussion 1 21st Oct 2003 05:04 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:42 AM.