View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Lavedas Tom Lavedas is offline
external usenet poster
 
Posts: 7
Default Code to hide columns problem

I don't understand what this line is trying to do ..

set shtarray = Sheets((DomShip, ConShip, IntShip, FinShip))

Well, actually, I do, but it is not a valid syntax. The closest I can think of is ..

shtarray = Array("DomShip", "ConShip", "IntShip", "FinShip")

This will create an array - of the NAMES of the sheets

Then in your HideQtly2003 subroutine you can access them with something like ..

for each name in shtarra
workbook.Sheet(name)..Columns("A:D").EntireColumn. Hidden = Tru
nex

This is 'air code', but I'm sure it's cloaser to what you need than your formulation

BTW, the missing external routine is almost certainly Sheets() in that first line of code

Tom Laveda


----- Steph wrote: ----

Hi. I wrote what I thought was going to be simple code. I adde
check boxes to my workbook using the control toolbox. The followin
code is called by one checkbox. All I am trying to do is hide column
A:D on 4 spreadsheets. When I run this I get the error Compile Error
Invalid Outside Procedure

Public SheetArray As Sheet

set shtarray = Sheets((DomShip, ConShip, IntShip, FinShip)) 'thes
sheets are named in the properties windo

Sub HideQtly2003(

Application.ScreenUpdating = Fals
shtarray.Columns("A:D").EntireColumn.Hidden = Tru
Application.ScreenUpdating = Tru

End Su


Any ideas? Thanks