Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11
Default Another query about hiding columns with Macros

I have a worksheet that contans data in columns A to BY.
I want to hide columns from some users as they are not interested in all the
data so I recorded a Macro to hide the columns that are irrelevant to those
users, here is the code (after a bit of cleanup):

Sheets("Internal Portfolio").Select
Range("A:G,I:I,L:M,O:Q,S:S,U:BA,BC:BI,BM:BR,BT:BY" ).Select
Range("BT1").Activate
Selection.EntireColumn.Hidden = True
Range("H4").Select

When I run this macro, some of the columns which should remain visible are
also getting hidden i.e. after running the macro, the visible columns are H,
BB, BJ to BL and BS so it seems my Macro is ignoring some of the Range...

Can anyone tell my why this happens and what I can do to fix it?

Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 180
Default Another query about hiding columns with Macros

chek out your this statement

Range("A:G,I:I,L:M,O:Q,S:S,U:BA,BC:BI,BM:BR,BT:BY" ).Select

Make sure that the range that you want visible is not in between the above
columns

HTH,
--
Pranav Vaidya
VBA Developer
PN, MH-India
If you think my answer is useful, please rate this post as an ANSWER!!


"Jim@Tech" wrote:

I have a worksheet that contans data in columns A to BY.
I want to hide columns from some users as they are not interested in all the
data so I recorded a Macro to hide the columns that are irrelevant to those
users, here is the code (after a bit of cleanup):

Sheets("Internal Portfolio").Select
Range("A:G,I:I,L:M,O:Q,S:S,U:BA,BC:BI,BM:BR,BT:BY" ).Select
Range("BT1").Activate
Selection.EntireColumn.Hidden = True
Range("H4").Select

When I run this macro, some of the columns which should remain visible are
also getting hidden i.e. after running the macro, the visible columns are H,
BB, BJ to BL and BS so it seems my Macro is ignoring some of the Range...

Can anyone tell my why this happens and what I can do to fix it?

Thanks!

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 515
Default Another query about hiding columns with Macros

Your code works perfectly for me!

--
Hth

Kassie Kasselman
Change xxx to hotmail


"Jim@Tech" wrote:

I have a worksheet that contans data in columns A to BY.
I want to hide columns from some users as they are not interested in all the
data so I recorded a Macro to hide the columns that are irrelevant to those
users, here is the code (after a bit of cleanup):

Sheets("Internal Portfolio").Select
Range("A:G,I:I,L:M,O:Q,S:S,U:BA,BC:BI,BM:BR,BT:BY" ).Select
Range("BT1").Activate
Selection.EntireColumn.Hidden = True
Range("H4").Select

When I run this macro, some of the columns which should remain visible are
also getting hidden i.e. after running the macro, the visible columns are H,
BB, BJ to BL and BS so it seems my Macro is ignoring some of the Range...

Can anyone tell my why this happens and what I can do to fix it?

Thanks!

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11
Default Another query about hiding columns with Macros

Thanks for the response Pranav, unfortunately it doesn't really address the
probelm...

The columns that should remain visible are columns H, J, K, N, R, T, BB, BJ,
BK, BL and BS. These are all excluded from the Range statement so I can't see
why the macro is hiding columns J,K,N,R and T...

"Pranav Vaidya" wrote:

chek out your this statement

Range("A:G,I:I,L:M,O:Q,S:S,U:BA,BC:BI,BM:BR,BT:BY" ).Select

Make sure that the range that you want visible is not in between the above
columns

HTH,
--
Pranav Vaidya
VBA Developer
PN, MH-India
If you think my answer is useful, please rate this post as an ANSWER!!


"Jim@Tech" wrote:

I have a worksheet that contans data in columns A to BY.
I want to hide columns from some users as they are not interested in all the
data so I recorded a Macro to hide the columns that are irrelevant to those
users, here is the code (after a bit of cleanup):

Sheets("Internal Portfolio").Select
Range("A:G,I:I,L:M,O:Q,S:S,U:BA,BC:BI,BM:BR,BT:BY" ).Select
Range("BT1").Activate
Selection.EntireColumn.Hidden = True
Range("H4").Select

When I run this macro, some of the columns which should remain visible are
also getting hidden i.e. after running the macro, the visible columns are H,
BB, BJ to BL and BS so it seems my Macro is ignoring some of the Range...

Can anyone tell my why this happens and what I can do to fix it?

Thanks!

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Another query about hiding columns with Macros

I bet you're using merged cells.

Merged cells behave slightly differently in each version of excel--but they
don't play nice in all versions (in my opinion).

If you don't have merged cells, you may want to show all the columns, then do
the hiding.

Jim@Tech wrote:

I have a worksheet that contans data in columns A to BY.
I want to hide columns from some users as they are not interested in all the
data so I recorded a Macro to hide the columns that are irrelevant to those
users, here is the code (after a bit of cleanup):

Sheets("Internal Portfolio").Select
Range("A:G,I:I,L:M,O:Q,S:S,U:BA,BC:BI,BM:BR,BT:BY" ).Select
Range("BT1").Activate
Selection.EntireColumn.Hidden = True
Range("H4").Select

When I run this macro, some of the columns which should remain visible are
also getting hidden i.e. after running the macro, the visible columns are H,
BB, BJ to BL and BS so it seems my Macro is ignoring some of the Range...

Can anyone tell my why this happens and what I can do to fix it?

Thanks!


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11
Default Another query about hiding columns with Macros

Genius!
Why didn't I think of that...? I really dislike merged cells, they seem to
cause so much more trouble than they are worth! Trouble is this is a shared
workbook and one of my colleagues was trying to make it look nice :/

Many thanks Dave, Excel rocks again!

"Dave Peterson" wrote:

I bet you're using merged cells.

Merged cells behave slightly differently in each version of excel--but they
don't play nice in all versions (in my opinion).

If you don't have merged cells, you may want to show all the columns, then do
the hiding.

Jim@Tech wrote:

I have a worksheet that contans data in columns A to BY.
I want to hide columns from some users as they are not interested in all the
data so I recorded a Macro to hide the columns that are irrelevant to those
users, here is the code (after a bit of cleanup):

Sheets("Internal Portfolio").Select
Range("A:G,I:I,L:M,O:Q,S:S,U:BA,BC:BI,BM:BR,BT:BY" ).Select
Range("BT1").Activate
Selection.EntireColumn.Hidden = True
Range("H4").Select

When I run this macro, some of the columns which should remain visible are
also getting hidden i.e. after running the macro, the visible columns are H,
BB, BJ to BL and BS so it seems my Macro is ignoring some of the Range...

Can anyone tell my why this happens and what I can do to fix it?

Thanks!


--

Dave Peterson

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Another query about hiding columns with Macros

There comes a time when everyone has to make that decision--do you want a nice
looking worksheet, or do you want something that functions?

I think most responders have come down on the functionality side.

Welcome to the group! <vbg

Jim@Tech wrote:

Genius!
Why didn't I think of that...? I really dislike merged cells, they seem to
cause so much more trouble than they are worth! Trouble is this is a shared
workbook and one of my colleagues was trying to make it look nice :/

Many thanks Dave, Excel rocks again!

"Dave Peterson" wrote:

I bet you're using merged cells.

Merged cells behave slightly differently in each version of excel--but they
don't play nice in all versions (in my opinion).

If you don't have merged cells, you may want to show all the columns, then do
the hiding.

Jim@Tech wrote:

I have a worksheet that contans data in columns A to BY.
I want to hide columns from some users as they are not interested in all the
data so I recorded a Macro to hide the columns that are irrelevant to those
users, here is the code (after a bit of cleanup):

Sheets("Internal Portfolio").Select
Range("A:G,I:I,L:M,O:Q,S:S,U:BA,BC:BI,BM:BR,BT:BY" ).Select
Range("BT1").Activate
Selection.EntireColumn.Hidden = True
Range("H4").Select

When I run this macro, some of the columns which should remain visible are
also getting hidden i.e. after running the macro, the visible columns are H,
BB, BJ to BL and BS so it seems my Macro is ignoring some of the Range...

Can anyone tell my why this happens and what I can do to fix it?

Thanks!


--

Dave Peterson


--

Dave Peterson
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
Strip workbook of macros, VBA, MS Query, etc. Paul Kraemer Excel Discussion (Misc queries) 4 September 7th 06 01:30 PM
hiding columns [email protected] Excel Discussion (Misc queries) 3 July 12th 06 04:42 PM
Hiding Columns belony Excel Discussion (Misc queries) 4 June 15th 05 12:27 AM
Hiding Macros mrbalaje Excel Discussion (Misc queries) 2 April 18th 05 08:11 AM
Hiding Macros PCn Excel Discussion (Misc queries) 0 February 17th 05 03:47 PM


All times are GMT +1. The time now is 02:43 PM.

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"