Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Automatically hide unused columns

I have a 10 year schedule which returns values to a defined point. Is there
a way to hide the unused columns with the numerical value i am entering.


As an example If i want to show 60 months of cash flow can i hide the other
60 when i enter this value.
--
Thanks for your help!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Automatically hide unused columns

Hi

You do not say where you want to enter # of month to show, so I used an
inputbox.

Sub HideUnusedCols()
Dim showCF As Long
Dim FirstDataColCell As Range
Dim FirstDataCol As Long
Dim LastDataCol As Long

showCF = InputBox _
("How many month of cash flow do you want to show ?", "Regards, Per")
FirstDataCol = 2 'Titles in column 1
LastDataCol = 121
Set FirstDataColCell = Cells(1, FirstDataCol)
FirstDataColCell.Resize(1, LastDataCol - FirstDataCol + 1) _
.EntireColumn.Hidden = False
If showCF < 120 Then
FirstDataColCell.Resize(1, LastDataCol - showCF - FirstDataCol + 1) _
.EntireColumn.Hidden = True
End If
End Sub

Regards,
Per

"jm913" skrev i meddelelsen
...
I have a 10 year schedule which returns values to a defined point. Is
there
a way to hide the unused columns with the numerical value i am entering.


As an example If i want to show 60 months of cash flow can i hide the
other
60 when i enter this value.
--
Thanks for your help!


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
How do I automatically hide empty columns in Excel? Ned Mains Excel Discussion (Misc queries) 3 April 29th 23 07:44 PM
Hide unused rows and columns kyleb Excel Discussion (Misc queries) 1 March 25th 10 02:24 AM
How do I automatically hide columns? PPM at Brackmills Excel Discussion (Misc queries) 8 March 18th 10 03:34 AM
hide columns automatically Chicom17 Excel Programming 1 June 17th 08 04:31 PM
Automatically hide/unhide columns laststraw Excel Discussion (Misc queries) 11 September 12th 07 12:54 PM


All times are GMT +1. The time now is 03:38 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"