View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary Keramidas Gary Keramidas is offline
external usenet poster
 
Posts: 2,494
Default Insert column and hide columns

you could try something like this

Sub hide_columns()
Dim arr As Variant
Dim i As Long
arr = Array("c:c", "e:e", "h:h", "m:m")
For i = LBound(arr) To UBound(arr)
Columns(arr(i)).EntireColumn.Hidden = True
Next
End Sub

--


Gary


"Rob" wrote in message
...
I need to hide a number of columns in a sheet and have used Columns
("C:C").EntireColumn.Hidden = True. This is fine but I have 15 columns to
hide and having 15 rows of code seems excessive. Is there a way to declare the
columns and thus apply in less rows of code?

Also, have similar issue with inserting where to say I want to insert 3 rows,
I have 3 rows of code.

Thanks, Rob