Results 1 to 3 of 3

Thread: Validating 2 Columns using excel VBA

  1. #1
    Junior Member
    Join Date
    Jul 2012
    Posts
    2
    Rep Power
    0

    Validating 2 Columns using excel VBA

    Hi guys, need your help in creating a vba code in validating 2 columns of data.


    This are the criteria:

    () Data are in Column B and C
    () Column B is the Country ID and Column C is the Country ID_2
    () Data in both column are consist of numbers
    () Data in Column B and C has been group and there separator is a blank row/cell. Group can be in 3, 4, 5, 10, 50, rows etc. (not fix)
    () In Column B 2 or more cell having the same number is consider as Valid.
    () In Column B if all value in the group has the same number and Column C has no data it is consider as valid
    () In Column B if all value in the group has the same number but 1 or more of column C has value the row in Column C having value should be consider as error.
    () In Column B, if there are 5 rows in a group 4 having the same number and the other 1 is different this row will be consider as error
    () In Column C if the entire group has value and column B is blank it is still consider an error.
    () If Both Col B and C has value it is consider as error.
    () Note: 2 or more same number in a group in Column B is consider as valid

    () "Error" remarks will be put in Column A (Validation Result) for errors found. (Red Font)
    () If there was no error found on entire column A will be filled with color orange.

    Column A - Validation Result
    Column B - Country ID
    Column C - Country ID_2
    Column D - Error Definition

    "Separator" - this is blank rows (group separator)

    Below is my example:


    Validation Result Country ID Country ID_2 Error Definition

    Error 3 1 Col B and C has Value
    1
    1
    separator separator separator separator
    6
    6
    Error 4 Column B (4) does not match the group w/c is 6
    6
    separator separator separator separator
    8
    Error 2 2 Col B and C has Value
    8
    8
    separator separator separator separator
    9
    9
    9
    Error 5 Does not match the group w/c is 9
    Error 4 Does not match the group w/c is 9
    Error 3 Does not match the group w/c is 9
    separator separator separator separator
    7
    7
    Error 4 Col B has no value but col C has 4
    Error 4 Col B has no value but col C has 4
    separator separator separator separator
    Error 8 Col B has no value but col C has 4
    Error 8 Col B has no value but col C has 4
    Error 8 Col B has no value but col C has 4



    If my explanation is unclear pls. let me know. Thank you

    I already posted this to mrexcel\forum heres the link Validating 2 Columns using excel VBA

    If re posting coming from other forum is prohibited kindly delete my post admin and im sorry.

    thank you

    freakszzy
    Last edited by freakszzy; 07-26-2012 at 07:53 AM.

  2. #2

  3. #3
    Junior Member
    Join Date
    Jul 2012
    Posts
    2
    Rep Power
    0
    The solution provided in other forum works just some revision and im done.Thanks a lot for given me the opportunity to post here in this forum.

    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    https://www.youtube.com/watch?v=jTmVtPHtiTg&lc=Ugy_RiNN_kAqUvZ8W994AaABAg
    https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgNsaS3Lp1
    https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgR1EPUkhw
    https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgNe_XC-jK
    https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgNPOdiDuv
    https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgN7AC7wAc
    https://www.youtube.com/watch?v=bs-urI_o8jo&lc=UgyBACXgNY4j_cHgH5J4AaABAg.9oTkVdzfqfm 9wlhQrYJP3M
    https://www.youtube.com/watch?v=bs-urI_o8jo&lc=UgxYgiEZuS9I3xkjJv54AaABAg
    https://www.youtube.com/watch?v=DVFFApHzYVk&lc=Ugyi578yhj9zShmhuPl4AaABAg
    https://www.youtube.com/watch?v=GqzeFYWjTxI&lc=UgxvxlnuTRWiV6MUZB14AaABAg
    https://www.youtube.com/watch?v=_8i1fVEi5WY&lc=Ugz0ptwE5J-2CpX4Lzh4AaABAg
    https://www.youtube.com/watch?v=0ltJS7uHfK4&lc=UgxoHAw8RwR7VmyVBUt4AaABAg. 9C-br0lEl8V9xI0_6pCaR9
    https://www.youtube.com/watch?v=0ltJS7uHfK4&lc=Ugz5DDCMqmHLeEjUU8t4AaABAg. 9bl7m03Onql9xI-ar3Z0ME
    https://www.youtube.com/watch?v=0ltJS7uHfK4&lc=UgxYnpd9leriPmc8rPd4AaABAg. 9gdrYDocLIm9xI-2ZpVF-q
    https://www.youtube.com/watch?v=0ltJS7uHfK4&lc=UgyjoPLjNeIAOMVH_u94AaABAg. 9id_Q3FO8Lp9xHyeYSuv1I
    https://www.reddit.com/r/windowsxp/comments/pexq9q/comment/k81ybvj/?utm_source=reddit&utm_medium=web2x&context=3
    https://www.youtube.com/watch?v=bs-urI_o8jo&lc=UgxYgiEZuS9I3xkjJv54AaABAg
    https://www.youtube.com/watch?v=bs-urI_o8jo&lc=UgyBACXgNY4j_cHgH5J4AaABAg.9oTkVdzfqfm 9wlhQrYJP3M
    ttps://www.youtube.com/watch?v=LP9fz2DCMBE
    https://www.youtube.com/watch?v=LP9fz2DCMBE&lc=UgzbPgJUMCztIOQDym14AaABAg
    https://www.youtube.com/watch?v=LP9fz2DCMBE&lc=UgzbPgJUMCztIOQDym14AaABAg. 9wdo_rWgxSH9wdpcYqrvp8
    ttps://www.youtube.com/watch?v=bFxnXH4-L1A
    https://www.youtube.com/watch?v=bFxnXH4-L1A&lc=UgxuODisjo6cvom7O-B4AaABAg.9w_AeS3JiK09wdi2XviwLG
    https://www.youtube.com/watch?v=bFxnXH4-L1A&lc=UgxBU39bTptFznDC1PJ4AaABAg
    ttps://www.youtube.com/watch?v=GqzeFYWjTxI
    https://www.youtube.com/watch?v=GqzeFYWjTxI&lc=UgwJnJDJ5JT8hFvibt14AaABAg
    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    Last edited by DocAElstein; 11-30-2023 at 02:54 PM.

Similar Threads

  1. Validating PAN (Indian Format)
    By Admin in forum Test Area
    Replies: 20
    Last Post: 03-22-2023, 06:14 PM
  2. Macro To Insert Columns In Excel
    By jac3130 in forum Excel Help
    Replies: 2
    Last Post: 05-17-2013, 07:49 AM
  3. VBA - Sorting by columns
    By Rasm in forum Excel Help
    Replies: 2
    Last Post: 09-24-2012, 04:18 PM
  4. Split Range into Multiple Columns VBA
    By Admin in forum Excel and VBA Tips and Tricks
    Replies: 3
    Last Post: 03-07-2012, 10:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •