VBA Program to Compare Lists in 4 Columns in Excel

Manick9

New member
Joined
Sep 8, 2016
Messages
2
Reaction score
0
Points
0
Hi all

I am quite New to VBA programming in Excel. Can someone please help me how to create a VBA Program to Compare 4 Columns in Excel and store the output to a txt file. I have searched it in multiple websites but i couldn't find it. I have my data from column A to F. I have a program without using dictionary but it takes too long as there are ard 31k lines in the list 1 and 32k lines in list

My data is in this format:

Source Data Dump Data

A B C D E F
[1] file format(4char) address(6char) data(66char) file format(4char) address(6char) data(66char)


1) If the first line (A2) or (D2) starts with "S011" or "S804" skip and read next line.

2) If the address in Column B matches the address in Column E, check if the adjacent data linked to it is also a match ie. if B10 = E10, check if C10 = F10. If there is a mismatch in data output to txt file in this format:

Source Data
Address
A10+B10+C10
Dump Data
Address
D10+E10+F10
Result: NOK

3) If column B address is not found in Column E ,

Output :
Source Data
Address
A10+B10+C10
Result: NOK

4) If column E address is not found in Column B , check if the string of data in column F are all 'F's excluding the last 2 characters.
if All F's then output OK
if Not All F's then output NOK

Output :
Dump Data
Address
D10+E10+F10
Result: NOK

Thanks a lot!
 
Hi snb, I have done 2 other tasks using excel VBA but those were not so complicated. I am not very comfortable using array and dictionary. If someone could tell how to integrate it into my code. It will we really helpful.


My code: codeshare . io/ QMVCX
 
Last edited:
If you could attach a sample workbook (with less that 31K rows :) ) showing what you want, it would be easier for us to help.
 
Back
Top