how to hide/unhide column or a range of column by entering a specific word in a specific column cell

azad092

Board Regular
Joined
Dec 31, 2019
Messages
198
Office Version
  1. 2007
Platform
  1. Windows
hi
dear members
good afternoon
please guide me how to hide/unhide column or a range of column by entering a specific word in a specific column cell
I want if in sheet A column F I enter the word "Nice" , the column E which is hide should be unhide, and in next entry if there is different word instead of Nice the column should be
again hide
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
You could use VBA for this...
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Range("F:F")) Is Nothing Then
    
        If Target.Value = "Nice" Then
            Me.Range("E:E").EntireColumn.Hidden = False
            
            Else
            Me.Range("E:E").EntireColumn.Hidden = True
        End If
    End If
End Sub
 
Upvote 0
You could use VBA for this...
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Range("F:F")) Is Nothing Then
   
        If Target.Value = "Nice" Then
            Me.Range("E:E").EntireColumn.Hidden = False
           
            Else
            Me.Range("E:E").EntireColumn.Hidden = True
        End If
    End If
End Sub
hi
good morning
thanks for your good response...
its a good work... but a little thing need more.... the coding is case sensitive.. if I enter Nice it works but if I enter nice it not work so please see it thanks
 
Upvote 0
I gave you exactly what you asked for.
If you want something different, you should specify this, in your original post. Otherwise, you waste peoples' time.

This should now work, for your latest requirement:
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Range("F:F")) Is Nothing Then
    
        If UCase(Target.Value) = "NICE" Then
            Me.Range("E:E").EntireColumn.Hidden = False
            
            Else
            Me.Range("E:E").EntireColumn.Hidden = True
        End If
    End If
End Sub
 
Upvote 0
I gave you exactly what you asked for.
If you want something different, you should specify this, in your original post. Otherwise, you waste peoples' time.

This should now work, for your latest requirement:
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Range("F:F")) Is Nothing Then
   
        If UCase(Target.Value) = "NICE" Then
            Me.Range("E:E").EntireColumn.Hidden = False
           
            Else
            Me.Range("E:E").EntireColumn.Hidden = True
        End If
    End If
End Sub
good work
thanks dear
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,750
Members
448,989
Latest member
mariah3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top