ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hide Column based on Cell Value (https://www.excelbanter.com/excel-programming/412900-hide-column-based-cell-value.html)

tomic

Hide Column based on Cell Value
 
I am trying to hide an entire column - column M, based on the value in Cell
I13.

I would like column M to be hidden if the value in I13 is "".

I am a novice with VB, and have tried numerous things without any luck. Any
suggestions or help would be appreciated.

Per Jessen[_2_]

Hide Column based on Cell Value
 
On 20 Jun., 21:11, tomic wrote:
I am trying to hide an entire column - column M, based on the value in Cell
I13.

I would like column M to be hidden if the value in I13 is "".

I am a novice with VB, and have tried numerous things without any luck. Any
suggestions or help would be appreciated.


Hi

This is an event code, which needs to be in the codesheet for the
desired sheet.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$I$13" Then
If Target.Value = "" Then
Columns("M").Hidden = True
Else
Columns("M").Hidden = False
End If
End If
End Sub

Regards,
Per

tomic

Hide Column based on Cell Value
 
Thanks very much. That did exactly what I wanted it to do.


"Per Jessen" wrote:

On 20 Jun., 21:11, tomic wrote:
I am trying to hide an entire column - column M, based on the value in Cell
I13.

I would like column M to be hidden if the value in I13 is "".

I am a novice with VB, and have tried numerous things without any luck. Any
suggestions or help would be appreciated.


Hi

This is an event code, which needs to be in the codesheet for the
desired sheet.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$I$13" Then
If Target.Value = "" Then
Columns("M").Hidden = True
Else
Columns("M").Hidden = False
End If
End If
End Sub

Regards,
Per



All times are GMT +1. The time now is 10:25 AM.

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