Check if a column is hidden or visible in VBA

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top