PC Review


Reply
Thread Tools Rate Thread

Check if a column is hidden or visible in VBA

 
 
=?Utf-8?B?U3RlcGhlbiBD?=
Guest
Posts: n/a
 
      6th Aug 2007
I have some VBA code which copies part of a spreadsheet to a new workbook,
when i copy it i need to be able to check if a column has been hidden or not,
if it has been hidden then i need to hide the same column on the new sheet.

e.g. If column F is hidden on the current sheet then hide column F on the
new workbook.

I am using Excel 2000.
 
Reply With Quote
 
 
 
 
JW
Guest
Posts: n/a
 
      6th Aug 2007
Can you please post up the code as it currently is?

Stephen C wrote:
> I have some VBA code which copies part of a spreadsheet to a new workbook,
> when i copy it i need to be able to check if a column has been hidden or not,
> if it has been hidden then i need to hide the same column on the new sheet.
>
> e.g. If column F is hidden on the current sheet then hide column F on the
> new workbook.
>
> I am using Excel 2000.


 
Reply With Quote
 
=?Utf-8?B?QW5vbnk=?=
Guest
Posts: n/a
 
      6th Aug 2007
Just tweak this until it fits your specific needs:

Sub HiddenColumns()
Dim i As Long

For i = 1 To 256
Workbooks("Workbook1").Sheets("Sheet1").Columns(i).Hidden =
Workbooks("Workbook1").Sheets("Sheet1").Columns(i).Hidden
Next i

End Sub

------
Cheers,
Anony


"Stephen C" wrote:

> I have some VBA code which copies part of a spreadsheet to a new workbook,
> when i copy it i need to be able to check if a column has been hidden or not,
> if it has been hidden then i need to hide the same column on the new sheet.
>
> e.g. If column F is hidden on the current sheet then hide column F on the
> new workbook.
>
> I am using Excel 2000.

 
Reply With Quote
 
=?Utf-8?B?U3RlcGhlbiBD?=
Guest
Posts: n/a
 
      7th Aug 2007
Just a little tweak and it works fine.

Thank you

"Anony" wrote:

> Just tweak this until it fits your specific needs:
>
> Sub HiddenColumns()
> Dim i As Long
>
> For i = 1 To 256
> Workbooks("Workbook1").Sheets("Sheet1").Columns(i).Hidden =
> Workbooks("Workbook1").Sheets("Sheet1").Columns(i).Hidden
> Next i
>
> End Sub
>
> ------
> Cheers,
> Anony
>
>
> "Stephen C" wrote:
>
> > I have some VBA code which copies part of a spreadsheet to a new workbook,
> > when i copy it i need to be able to check if a column has been hidden or not,
> > if it has been hidden then i need to hide the same column on the new sheet.
> >
> > e.g. If column F is hidden on the current sheet then hide column F on the
> > new workbook.
> >
> > I am using Excel 2000.

 
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
Hidden column is visible on reload ArunDhaJ Microsoft C# .NET 1 21st May 2010 02:35 PM
Check Control if Visible or hidden Abe Katz Microsoft Access Forms 1 4th Mar 2010 10:10 PM
Events - controls visible/hidden depending on a check box =?Utf-8?B?TmV3S2lkb250aGVCbG9jaw==?= Microsoft Access Form Coding 2 8th Aug 2006 02:02 PM
Summing visible column values but not hidden column values =?Utf-8?B?Qlc=?= Microsoft Excel Misc 2 2nd Nov 2004 06:32 PM
Check status row (hidden or visible)? Martin Los Microsoft Excel Programming 1 18th Dec 2003 03:32 PM


Features
 

Advertising
 

Newsgroups
 


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