ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Display column when previous column contains data (https://www.excelbanter.com/excel-programming/380437-display-column-when-previous-column-contains-data.html)

[email protected]

Display column when previous column contains data
 
The problem I have is that I have 10 years worth of data in 10 columns
and then 20 empty columns after those awaiting data entry (for the next
20 years). I was wondering if it was possible to hide these columns,
leaving only one empty column. When the header for this empty column
(the year) is filled in, I want the next empty column to be displayed.
Does anyone know if this is possible? (the columns contain many
formulas and are also called upon by other sheets.)

Thank you very much in advance if you can help!!!

Matt


Don Guillett

Display column when previous column contains data
 
Right click sheet tabview codeinsert thissave

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row < 1 Then Exit Sub
If Len(Target) 1 Then _
Columns(Target.Column + 1).Hidden = False
End If
End Sub

However, you might consider adding the formulas by macro as each year is
needed. Much less overhead. You could also then change the preceeding
formulas to values for the same reason.

--
Don Guillett
SalesAid Software

wrote in message
oups.com...
The problem I have is that I have 10 years worth of data in 10 columns
and then 20 empty columns after those awaiting data entry (for the next
20 years). I was wondering if it was possible to hide these columns,
leaving only one empty column. When the header for this empty column
(the year) is filled in, I want the next empty column to be displayed.
Does anyone know if this is possible? (the columns contain many
formulas and are also called upon by other sheets.)

Thank you very much in advance if you can help!!!

Matt





All times are GMT +1. The time now is 08:36 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com