Hi guys.. I require help in writing macros for the following checks.. I am also attaching the sample workbook below..
1. Validation check_1: Check the length and value of “Customer#/ADU”.
The allowed conditions are listed below. If error conditions are raised show the Error message to the “Result” column line.
Column name Length Value Error Message
Customer# 6byte “No check” ERROR:Invalid Customer#
ADU 1byte 2/3/7 ERROR:Invalid ADU
I have used this snippet but it doesn't seem to work..
lastrow = Worksheets("Main data").Range("A" & Rows.Count).End(xlUp).Row
mx = 6
For i = 9 To lastrow
If Len("B" & i) < mx Then
Range("G" & i).Value = "ERROR:Invalid Customer#"
Enf If
Next i
2. Validation Check_2: Check the “Data Value”
Check the length of “Data Value” filed. Get the information of correct length of each value from “Length” field of “Table information”. “Blank” is also allowed for exceptionally condition..
If error condition is raised, show the Error message” ERROR: Invalid Data value” to the “Result line” field on “Main data” sheet.
Regards
Sravanthi
Bookmarks