How to check two fields in excel and act by that?
Solved/Closed
akaldojad
akaldojad
- Posts
- 3
- Registration date
- Sunday April 7, 2013
- Status
- Member
- Last seen
- April 12, 2013
akaldojad
- Posts
- 3
- Registration date
- Sunday April 7, 2013
- Status
- Member
- Last seen
- April 12, 2013
Related:
- How to check two fields in excel and act by that?
- How to check date format in excel - Guide
- How to check author name in excel - Guide
- How to check previous version of excel file - Guide
- Convert a date field in excel to day of week ✓ - Forum - Excel
- Excel vba check if value in array - Guide
3 replies
TrowaD
Apr 8, 2013 at 11:11 AM
- Posts
- 2886
- Registration date
- Sunday September 12, 2010
- Status
- Moderator
- Last seen
- June 27, 2022
Apr 8, 2013 at 11:11 AM
Hi Akaldojad,
Assuming A2 is entered first, try this code:
To implement the code, right-click the sheets tab and paste the code in the big white field.
Best regards,
Trowa
Assuming A2 is entered first, try this code:
Private Sub Worksheet_Change(ByVal Target As Range) If Intersect(Target, Range("A4")) Is Nothing Or _ Range("A4") = vbNullString Then Exit Sub If Range("A2") = Range("A4") Then CreateObject("WScript.Shell").Popup "OK!", 5, "This closes itself in 5 seconds" Else: MsgBox Chr(10) & Chr(10) & Chr(10) & Chr(10) & Chr(10) & Chr(10) & _ "Warning! CODES DO NOT MATCH" & Chr(10) & Chr(10) & Chr(10) & Chr(10) & Chr(10) & Chr(10), vbExclamation MsgBox "Please read again", vbInformation End If Range("A2").ClearContents Range("A4").ClearContents End Sub
To implement the code, right-click the sheets tab and paste the code in the big white field.
Best regards,
Trowa
akaldojad
Apr 12, 2013 at 03:26 AM
- Posts
- 3
- Registration date
- Sunday April 7, 2013
- Status
- Member
- Last seen
- April 12, 2013
Apr 12, 2013 at 03:26 AM
Thanks! Working like charm:)
akaldojad
Apr 12, 2013 at 03:27 AM
- Posts
- 3
- Registration date
- Sunday April 7, 2013
- Status
- Member
- Last seen
- April 12, 2013
Apr 12, 2013 at 03:27 AM
Thanks! Its working like should.