If Target.Cells.Count > 1 Then Exit Sub
If Target.Cells.Count > 1 Then Application.EnableEvents = True: Exit Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Intersect(Target, [E2]) Is Nothing Then
Application.EnableEvents = False
Application.ScreenUpdating = False
[E2].ClearContents
Application.ScreenUpdating = True
Application.EnableEvents = True
End If
End Sub
I have created a dropdown list that runs different macro's based on the value selected, however, I want to make this cell range default to empty when is inactive.
How would I be able to do this to default the cell range to empty when inactive
Hi Misra ,
I would like OP to explain the meaning of inactive.
If you ask me , the purpose of any dropdown is to show what the user has selected ; only in the case of cascading dropdowns is it justified to blank out a dropdown , since if a higher-level dropdown has changed , any earlier selection in a lower-level dropdown is invalid , and can often mislead the user.
I have suggested that , if at all it is acceptable to clear a dropdown , have the ClearContents statement applied to the dropdown once the procedure which was called based on the dropdown selection has completed.
If a dropdown has 5 options , a single statement has to be included in those 5 procedures ; I do not know if this is cumbersome , only the OP can confirm.
Having a SelectionChange event procedure , especially when the procedure is concerned with just one cell , is illogical , as far as I am concerned ; if at all this procedure is to be used in multiple cells , then too the same method of clearing the cell after the procedure has completed can be adopted.
Let us wait for the OP to respond before we proceed further ; if he is happy with the uploaded code , it is a waste of our time to discuss this further.
Narayan
Private Sub Worksheet_Change(ByVal Target As Range) 'Change event to ensure the cascading list says what we want it to.
If Not Intersect(Target, [c6]) Is Nothing Then
If [c6] = "UAE" Or [c6] = "EMD" Then
[J6] = "ALL"
ElseIf [c6] = "Region" Then
[c6] = "ALL"
[J6] = "ALL"
Else
[J6] = [c6]
End If
ElseIf Not Intersect(Target, Range("Month")) Is Nothing Then
[AF6] = Range("month")
End If
Select Case Range("AH1").Value
Case "Project Delta Report"
Call Project_Delta_Report
Case "Project Deviation Report"
Sheets("Project Deviation Report").Select
Case Else
Exit Sub
End Select
End Sub