Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default Mulipule Columns & VBA

I have a series of columns I wish to hide, these change depending on the
report selected
VBA refers to F18 on sheets1 and changes dependent on the report selected
code is;
Sheets(2).Select
Columns("V:AB").Select ' Resets all columns
Selection.EntireColumn.Hidden = False

colhide = sheets(1).range("F18")
Sheets(2).Select
Columns(colhide).Select
Selection.EntireColumn.Hidden = True

This works if the Columns are a continious block ie. F18 = "B;F"
but fails if F18="B:B,F:AA,AC:AC"

Any ideas
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Mulipule Columns & VBA

Hi,

Try this in F18
V:V,W:W,X:X,Y:Y,Z:Z,AA:AA,AB:AB, AF:AF

and you may find this a little better

Sub ordinate()
colhide = Sheets(1).Range("F18")
Sheets(2).Select
Range(colhide).EntireColumn.Hidden = True
End Sub

Mike

"Excel 2007 - SPB" wrote:

I have a series of columns I wish to hide, these change depending on the
report selected
VBA refers to F18 on sheets1 and changes dependent on the report selected
code is;
Sheets(2).Select
Columns("V:AB").Select ' Resets all columns
Selection.EntireColumn.Hidden = False

colhide = sheets(1).range("F18")
Sheets(2).Select
Columns(colhide).Select
Selection.EntireColumn.Hidden = True

This works if the Columns are a continious block ie. F18 = "B;F"
but fails if F18="B:B,F:AA,AC:AC"

Any ideas

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default Mulipule Columns & VBA

Works Great

Thanks I knew it would be simple

"Mike H" wrote:

Hi,

Try this in F18
V:V,W:W,X:X,Y:Y,Z:Z,AA:AA,AB:AB, AF:AF

and you may find this a little better

Sub ordinate()
colhide = Sheets(1).Range("F18")
Sheets(2).Select
Range(colhide).EntireColumn.Hidden = True
End Sub

Mike

"Excel 2007 - SPB" wrote:

I have a series of columns I wish to hide, these change depending on the
report selected
VBA refers to F18 on sheets1 and changes dependent on the report selected
code is;
Sheets(2).Select
Columns("V:AB").Select ' Resets all columns
Selection.EntireColumn.Hidden = False

colhide = sheets(1).range("F18")
Sheets(2).Select
Columns(colhide).Select
Selection.EntireColumn.Hidden = True

This works if the Columns are a continious block ie. F18 = "B;F"
but fails if F18="B:B,F:AA,AC:AC"

Any ideas

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
to convert columns to rows having mulit independent group columns Quacy Excel Worksheet Functions 1 August 22nd 06 11:20 PM
Combine multiple columns into two long columns, Repeating rows in first column [email protected] Excel Discussion (Misc queries) 2 July 31st 06 09:45 PM
Combine multiple columns into two long columns, Repeating rows in first column [email protected] Excel Discussion (Misc queries) 0 July 31st 06 05:07 PM
Pivot Table Creating New Columns that Subtract Two Existing Columns den4673 Excel Discussion (Misc queries) 3 December 17th 04 01:31 PM
Why text to columns is not available when there is mulipule line . Bing Excel Worksheet Functions 1 December 8th 04 05:14 AM


All times are GMT +1. The time now is 01:23 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"