I have a project due in 5 days. I am trying to create a tool using macro so that when few criteria are selected, a certain rating will be shown. There are three criteria that need to be filtered before getting the result. For example, if the industry (eg. agriculture) is selected, followed by selection of countries (e.g Indonesia), followed by selection of certain ratio (e.g.2.5), a rating from 1 to 6 will be given (in this case, 3). I tried the following code ,and nothing appears under my rating column but there is no error message. Can someone please help me out. Codes are shown below.
Code:
Private Sub CommandButton1_Click()
If Range("V4").Value = "A.Agriculture,forestry and fishing" Then
If Range("W4").Value = All Or ID Or SG Then
If Range("D4").Value <= 0 Then
Range("X4").Value = 6
ElseIf Range("M4").Value > 4 Then
Range("X4").Value = 5
ElseIf Range("M4").Value <= 4 And Value > 2 Then
Range("X4").Value = 4
ElseIf Range("M4").Value <= 2 And Value > 1 Then
Range("X4").Value = 3
ElseIf Range("M4").Value <= 1 And Value > 0 Then
Range("X4").Value = 2
ElseIf Range("M4").Value <= 0 Then
Range("X4").Value = 1
End If
ElseIf Range("W4").Value = MY Or TH Then
If Range("D4").Value <= 0 Then
Range("X4").Value = 6
ElseIf Range("M4").Value > 4.5 Then
Range("X4").Value = 5
ElseIf Range("M4").Value <= 4.5 And Value > 2 Then
Range("X4").Value = 4
ElseIf Range("M4").Value <= 2 And Value > 1 Then
Range("X4").Value = 3
ElseIf Range("M4").Value <= 1 And Value > 0 Then
Range("X4").Value = 2
ElseIf Range("M4").Value <= 0 Then
Range("X4").Value = 1
End If
Else: Range("X4").Value = ""
End If
Else If Range("V4").Value = "B.Mining and quarrying" Then
If Range("W4").Value = All Or ID Or MY Or SG Or TH Then
If Range("D4").Value <= 0 Then
Range("X4").Value = 6
ElseIf Range("M4").Value > 3.5 Then
Range("X4").Value = 5
ElseIf Range("M4").Value <= 3.5 And Value > 2 Then
Range("X4").Value = 4
ElseIf Range("M4").Value <= 2 And Value > 1 Then
Range("X4").Value = 3
ElseIf Range("M4").Value <= 1 And Value > 0 Then
Range("X4").Value = 2
ElseIf Range("M4").Value <= 0 Then
Range("X4").Value = 1
End If
Else: Range("X4").Value = ""
End If
End If
End Sub