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 "agriculture industry" is selected, followed by selection of "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 but nothing appears under my rating column. Can someone please help me out. Codes are shown below.
>
Private Sub CommandButton1_Click() Dim Value As Double 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
ElseIf 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
Aucun commentaire:
Enregistrer un commentaire