VBA Macro Help
Solved/Closed
froggy7897
Posts
2
Registration date
Tuesday May 22, 2012
Status
Member
Last seen
May 24, 2012
-
May 22, 2012 at 03:27 PM
froggy7897 Posts 2 Registration date Tuesday May 22, 2012 Status Member Last seen May 24, 2012 - May 24, 2012 at 10:22 AM
froggy7897 Posts 2 Registration date Tuesday May 22, 2012 Status Member Last seen May 24, 2012 - May 24, 2012 at 10:22 AM
Related:
- VBA Macro Help
- Vba case like - Guide
- Number to words in excel formula without vba - Guide
- Vba check if value is in array - Guide
- Vba color index - Guide
- How to open vba in excel - Guide
3 responses
Mehedad
Posts
22
Registration date
Thursday April 19, 2012
Status
Member
Last seen
April 16, 2013
3
May 23, 2012 at 12:00 AM
May 23, 2012 at 12:00 AM
I don't think Macro is needed, you can write the formula below in E2:
=IF(AND(A2=A1,AND(B2=B1,C2=C1,D2=D1)),"GOOD",IF(A2<>A1,"","BAD"))
Copy and Paste till the end.
=IF(AND(A2=A1,AND(B2=B1,C2=C1,D2=D1)),"GOOD",IF(A2<>A1,"","BAD"))
Copy and Paste till the end.
Mehedad
Posts
22
Registration date
Thursday April 19, 2012
Status
Member
Last seen
April 16, 2013
3
May 23, 2012 at 12:08 AM
May 23, 2012 at 12:08 AM
If you need a macro, here is the code:
Sub findResult()
Dim Kit, Item, Item2, Item3, Results As Range
Dim itemCount As Long
itemCount = Range("A1").CurrentRegion.Rows.Count
Set Kit = Range("A:A")
Set Item = Range("B:B")
Set Item2 = Range("C:C")
Set Item3 = Range("D:D")
Set Results = Range("E:E")
For i = 3 To itemCount
Select Case Kit(i, 1) = Kit(i - 1, 1)
Case True
If Item(i, 1) = Item(i - 1, 1) And Item2(i, 1) = Item2(i - 1, 1) _
And Item3(i, 1) = Item3(i - 1, 1) Then
Results(i, 1) = "GOOD"
End If
If (Item(i, 1) = Item(i - 1, 1) And Item2(i, 1) = Item2(i - 1, 1) _
And Item3(i, 1) = Item3(i - 1, 1)) = False Then
Results(i, 1) = "BAD"
End If
Case False
Results(i, 1) = ""
End Select
Next i
End Sub
Codes can be improved, I am not so efficient with the codes, but it still works! :)
Sub findResult()
Dim Kit, Item, Item2, Item3, Results As Range
Dim itemCount As Long
itemCount = Range("A1").CurrentRegion.Rows.Count
Set Kit = Range("A:A")
Set Item = Range("B:B")
Set Item2 = Range("C:C")
Set Item3 = Range("D:D")
Set Results = Range("E:E")
For i = 3 To itemCount
Select Case Kit(i, 1) = Kit(i - 1, 1)
Case True
If Item(i, 1) = Item(i - 1, 1) And Item2(i, 1) = Item2(i - 1, 1) _
And Item3(i, 1) = Item3(i - 1, 1) Then
Results(i, 1) = "GOOD"
End If
If (Item(i, 1) = Item(i - 1, 1) And Item2(i, 1) = Item2(i - 1, 1) _
And Item3(i, 1) = Item3(i - 1, 1)) = False Then
Results(i, 1) = "BAD"
End If
Case False
Results(i, 1) = ""
End Select
Next i
End Sub
Codes can be improved, I am not so efficient with the codes, but it still works! :)
froggy7897
Posts
2
Registration date
Tuesday May 22, 2012
Status
Member
Last seen
May 24, 2012
May 24, 2012 at 10:22 AM
May 24, 2012 at 10:22 AM
Thank you, this works perfect.