hide row on spreadsheet

G

Graham

please advise if it is possible to hide a row if data is entered in a
specific cell within that row.As an example if I enter the text "Yes" in cell
D2, then row 2 must then be hidden !! Just a thought as I am creating a
spreadsheet to track items and once I have actioned a certain task I then
want to auto hide that item.

Thanx Graham
 
B

Bob Umlas

Right-click the sheet tab, select View Code, enter this:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 4 Then
If LCase(Target.Value) = "yes" Then
Target.EntireRow.Hidden = True
End If
End If
End Sub
 
G

Graham

Thanks Bob,is it possible to create a command button (maybe2) where I would
click command button 1 to hide rows as per your code and also have a command
button 2 to retrieve/view all hidden data.

Thanx in advance
Graham
 
G

Graham

Hi Bob thanks for the below...
I am using another code which reads
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("B:L")) Is Nothing Then
On Error Resume Next
Application.EnableEvents = False
If Not Target.HasFormula Then Target.Value =
UCase(Target.Value)
Application.EnableEvents = True
On Error GoTo 0
End If
Private Sub Worksheet_Change(ByVal Target As Range)
If End Sub
and i want to add your code , please advise how do i do this as i did paste
it in but I get an error "ambiguous name detected "
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top