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
163
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

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

sykes

Well-known Member
Joined
May 1, 2002
Messages
1,882
Office Version
  1. 365
Platform
  1. Windows
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
 

azad092

Board Regular
Joined
Dec 31, 2019
Messages
163
Office Version
  1. 2007
Platform
  1. Windows
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
 

sykes

Well-known Member
Joined
May 1, 2002
Messages
1,882
Office Version
  1. 365
Platform
  1. Windows
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
 

azad092

Board Regular
Joined
Dec 31, 2019
Messages
163
Office Version
  1. 2007
Platform
  1. Windows
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
 

Forum statistics

Threads
1,141,869
Messages
5,709,092
Members
421,615
Latest member
RAB29

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
Top