View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
JLatham JLatham is offline
external usenet poster
 
Posts: 2,203
Default automatically deleting data, using macros

For just 3 conditions, you could use
IF Range("B3")= "condition 1"
action
ElseIf Range("B3") = "condition 2"
action code
Else
3rd 'catch all' action
End If

Or if you think you may eventually have more than 3 conditions, using Select
Case could be a better option, as it's easier to modify later. The
UCase(Trim( will remove white space at beginning/end of B3, and convert all
to upper case for testing to take the worry out of case of value in B3.
Select Case UCase(Trim(Range("B3")))
Case Is = "CONDITION 1"
action code for condition 1
Case Is = "CONDITION 2"
action code for condition 2
Case Is = "CONDITION 3"
action code for condition 3
Case Else
'catch anything else code, this
'can actually be empty, i.e. do nothing
End Select

Hope this helps
"Derrick" wrote:

i have some code on the bottom of one of my sheets, something like this:
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("B3")) Is Nothing Then Exit Sub
Rows("6:47").EntireRow.Hidden = False

If Range("B3") = "Standardized Module Width" Then
Rows("6:6").EntireRow.Hidden = False
:
Rows("15:15").EntireRow.Hidden = False
end if
end if
end sub
:
Im wondering if its possible to delete the information in cells, eg: F6,
F15, ... when another option is selected - so not Standardized module width
- i have 3 options...

can anyone help?