Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
rss rss is offline
external usenet poster
 
Posts: 1
Default Hiding and unhiding columns


Hi.

I have a spreadsheet that is laid out with 4 columns that repeat 50
times. So a total of 200 columns. I need a macro that will hide 3
columns and then move over. That way every time I hit CTRL-H 3 columns
are hidden. If I hit Ctrl-h 50 times I would have only 1 column
repeated 50 times. For my actual spread sheet the columns I want to
hide are contiguous but it would be nice to have a more general macro
that lets you select the number of columns that are repeated and which
ones you want to hide each time you hit the macro.

Of course an antidote to this where we unhide what we've done would be
needed too. Thanks for your help.

When I recorded my macro here's what I got:

Sub hide3()
'
' hide3 Macro
' Macro recorded 6/22/2005 by rss
'
' Keyboard Shortcut: Ctrl+h
'
Columns("E:G").Select
Range("E23").Activate
Selection.EntireColumn.Hidden = True
Columns("I:K").Select
Range("I23").Activate
Selection.EntireColumn.Hidden = True
End Sub

The problem is it is not picking up the movement that I need as well as
not addressing the more general issues with this type of macro.

Thanks again.
Edit/Delete Message


--
rss
------------------------------------------------------------------------
rss's Profile: http://www.excelforum.com/member.php...o&userid=24524
View this thread: http://www.excelforum.com/showthread...hreadid=381214

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Hiding and unhiding columns

numcol = 3
totcol = 4
columns.Hidden = False
for i = 5 to totcol + 50*totcol step totcol
cells(1,i).Resize(1,numcol).EntireColumn.Hidden = True
Next

Might be something you could work with.

--
Regards,
Tom Ogilvy


"rss" wrote in message
...

Hi.

I have a spreadsheet that is laid out with 4 columns that repeat 50
times. So a total of 200 columns. I need a macro that will hide 3
columns and then move over. That way every time I hit CTRL-H 3 columns
are hidden. If I hit Ctrl-h 50 times I would have only 1 column
repeated 50 times. For my actual spread sheet the columns I want to
hide are contiguous but it would be nice to have a more general macro
that lets you select the number of columns that are repeated and which
ones you want to hide each time you hit the macro.

Of course an antidote to this where we unhide what we've done would be
needed too. Thanks for your help.

When I recorded my macro here's what I got:

Sub hide3()
'
' hide3 Macro
' Macro recorded 6/22/2005 by rss
'
' Keyboard Shortcut: Ctrl+h
'
Columns("E:G").Select
Range("E23").Activate
Selection.EntireColumn.Hidden = True
Columns("I:K").Select
Range("I23").Activate
Selection.EntireColumn.Hidden = True
End Sub

The problem is it is not picking up the movement that I need as well as
not addressing the more general issues with this type of macro.

Thanks again.
Edit/Delete Message


--
rss
------------------------------------------------------------------------
rss's Profile:

http://www.excelforum.com/member.php...o&userid=24524
View this thread: http://www.excelforum.com/showthread...hreadid=381214



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
Hiding/Unhiding Columns Karen McKenzie Excel Worksheet Functions 3 August 10th 06 11:49 AM
Hiding/Unhiding Columns xkarenxxxx Excel Worksheet Functions 8 June 5th 06 02:18 PM
hiding/unhiding rows & columns with "+" and "-" buttons shellshock Excel Discussion (Misc queries) 2 August 3rd 05 05:22 AM
Problem hiding/unhiding columns using combo control olivier durand Excel Programming 2 October 28th 03 03:07 PM
Event triggered by Hiding/Unhiding columns? Jerry W. Lewis Excel Programming 1 July 23rd 03 09:17 AM


All times are GMT +1. The time now is 07:06 AM.

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

About Us

"It's about Microsoft Excel"