Loop through 20 columns of emails to validate

Woodsa

New Member
Joined
Feb 26, 2021
Messages
12
Office Version
  1. 365
Platform
  1. Windows
Hi, I am looking to loop through 20 columns of emails to see if they exist in an an array of excluded emails.

I have 23 columns, example below. The Validation column is after the 20 columns of emails so would be column number 23 (Col W).

some of the columns are blank so these need to be skipped.

I was planning to do this with a Do While, but I am still just learning loops and haven't used an array before.

I got this far and thought that I'd ask for help

VBA Code:
Sub Email_Validation()
    
Dim i As Integer
    i = 1

Dim MyArray() As Variant
    MyArray = Worksheet(2).Range("A1").CurrentRegion
    
Do While Cells(i, 3).Value <> MyArray

Loop

ID NumberOriginal EmailsEmail 1Valid Email (Y/N)
1234567891234email@email.com email1@email.comChecks the 3rd column to see if it exists in the designated array, if not = "Y" and exit loop.

If it does match it needs to check the next column until it finds a value that does not match the array or if it gets to the end and they all match it needs to return "N"
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

Forum statistics

Threads
1,215,069
Messages
6,122,952
Members
449,095
Latest member
nmaske

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top