Hi guys,
I have two dropdown lists, one for Status (column G), and one for Priority (column H) in one sheet.
Status list items: Avvakta, Underlag saknas, Utgår, Pågår, Klart
Priority list items: Prio 1, Prio 2, Prio 3, Övrigt
Now I've got a code that needs some modification in order to prevent items: Avvakta, Underlag saknas, Pågår, and Prio 2 to trigger any action at all except being selected, but I dont know how to do that.
Please help.
I've got the original code from forum member Fluff, I am not coder myself.
Please someone help.
I have two dropdown lists, one for Status (column G), and one for Priority (column H) in one sheet.
Status list items: Avvakta, Underlag saknas, Utgår, Pågår, Klart
Priority list items: Prio 1, Prio 2, Prio 3, Övrigt
Now I've got a code that needs some modification in order to prevent items: Avvakta, Underlag saknas, Pågår, and Prio 2 to trigger any action at all except being selected, but I dont know how to do that.
Please help.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Ans As String
Dim ws As Worksheet, nextrow As Long
Dim Sht As String
If Target.CountLarge > 1 Then Exit Sub
If Intersect(Target, Range("H10:H110,G10:G110")) Is Nothing Then Exit Sub
Application.ScreenUpdating = False
Application.EnableEvents = False
Sht = Target.Value
Select Case Sht
[COLOR=#669933]'------------------------------------------------------------------------------------------------------------------
'Move Prio 1, Prio 3 and Övrigt to corresponding sheets, but do nothing when Prio 2 is slected. How ??
'------------------------------------------------------------------------------------------------------------------[/COLOR]
Case "Prio 1"
If Not Evaluate("isref('" & Sht & "'!a1)") Then Sheets.Add.Name = "Prio 1"
Set ws = Sheets("Prio 1")
[COLOR=#669933]'Case "Prio 2"
'If Not Evaluate("isref('" & Sht & "'!a1)") Then Sheets.Add.Name = "Prio 2"
'Set ws = Sheets("Prio 2")[/COLOR]
Case "Prio 3"
If Not Evaluate("isref('" & Sht & "'!a1)") Then Sheets.Add.Name = "Prio 3"
Set ws = Sheets("Prio 3")
Case "Övrigt"
If Not Evaluate("isref('" & Sht & "'!a1)") Then Sheets.Add.Name = "Övrigt"
Set ws = Sheets("Övrigt")
[COLOR=#669933]'-------------------------------------------------------------------------------------------------------------------------------------------------------
'Move status Utgår and Klart to sheets Utgår and Klart, but do nothing when Avvakta, Underlag saknas and Pågår are selected. How???
'-------------------------------------------------------------------------------------------------------------------------------------------------------[/COLOR]
Case "Utgår"
If Not Evaluate("isref('" & Sht & "'!a1)") Then Sheets.Add.Name = "Utgår"
Set ws = Sheets("Utgår")
Case "Klart"
If Not Evaluate("isref('" & Sht & "'!a1)") Then Sheets.Add.Name = "Klart"
Set ws = Sheets("Klart")
'----------------------------------------------------------------------------------
[COLOR=#669900] ' Dont know what to do here....All items are triggering same action below
'---------------------------------------------------------------------------------[/COLOR]
End Select
Me.Activate
If MsgBox("Ska Almin flytta ärendet till fliken " & Sht & "?", vbYesNo + vbQuestion) = vbYes Then
Target.EntireRow.Copy ws.Range("A" & Rows.Count).End(xlUp).Offset(1)
Target.Select
Target.EntireRow.Delete
If MsgBox("Vill du öppna fliken " & Sht & " nu?", vbYesNo + vbQuestion) = vbYes Then Sheets(Sht).Activate
Else
Target.ClearContents
End If
Application.EnableEvents = True
End Sub
I've got the original code from forum member Fluff, I am not coder myself.
Please someone help.