Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Insert column and hide columns
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Insert column and hide columns
Thanks Gary, Am I correct to think that inserting rows or columns would
work the same way? Regards, Rob "Gary Keramidas" <GKeramidasATmsn.com wrote in message ... 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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Insert column and hide columns
Rob wrote:
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 Or:- ("C:Z").EntireColumn.Hidden = True. -- Message posted via http://www.officekb.com |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Insert column and hide columns
Francois, thanks however the columns aren't concurrent, eg I want to hide c,
e, m, j, x Regards, Rob "Francois via OfficeKB.com" <u18959@uwe wrote in message news:80fc6b5184ea6@uwe... Rob wrote: 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 Or:- ("C:Z").EntireColumn.Hidden = True. -- Message posted via http://www.officekb.com |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Insert column and hide columns
Range("C:C,F:H,J:J,P:T").EntireColumn.Hidden = True
"Rob" wrote: Francois, thanks however the columns aren't concurrent, eg I want to hide c, e, m, j, x Regards, Rob "Francois via OfficeKB.com" <u18959@uwe wrote in message news:80fc6b5184ea6@uwe... Rob wrote: 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 Or:- ("C:Z").EntireColumn.Hidden = True. -- Message posted via http://www.officekb.com |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Insert column and hide columns
Thanks Patrick.
"Patrick Molloy" wrote in message ... Range("C:C,F:H,J:J,P:T").EntireColumn.Hidden = True "Rob" wrote: Francois, thanks however the columns aren't concurrent, eg I want to hide c, e, m, j, x Regards, Rob "Francois via OfficeKB.com" <u18959@uwe wrote in message news:80fc6b5184ea6@uwe... Rob wrote: 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 Or:- ("C:Z").EntireColumn.Hidden = True. -- Message posted via http://www.officekb.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Hide Rows or Columns with +/- button above row/column label headin | Excel Worksheet Functions | |||
I forgot to insert columns within a column | Excel Discussion (Misc queries) | |||
hide columns by column number | Excel Programming | |||
Insert a blank Column Every 9 Columns | Excel Programming | |||
Insert Blank Column every 9 Columns | Excel Programming |