Link to home
Start Free TrialLog in
Avatar of wgraphics
wgraphics

asked on

Is there a way to auto check data in a column in Excel 2007

Each week I am given an Excel spreadsheet from another department. The number of rows vary from 100 to 300 or so, but the columns (A-AN) never change.

The data in Column L can only have one of 3 options in it: 361111759, 361111223, or anything starting with DDY (example DDY123478).

Is there an easy way to create a "check" to make sure one of those 3 are in Column L?

I know I can go to the Toolbar | Sort & Filter | Filter and glance at the list and do the check from there, but am wondering if there is a quicker, slicker way to do it?

Thanks!
Megan
Avatar of kgerb
kgerb
Flag of United States of America image

Hello Megan,
I think this macro will do what you want.  if you need help implementing let me know.

Sub CheckStuff()
Dim r As Range
Dim s1 As String, s2 As String
s1 = "One of the three exists"
s2 = "None of the three exsts"
Set r = Range("L:L").Find(361111759, LookIn:=xlValues, lookat:=xlWhole)
Set r = Range("L:L").Find(361111223, LookIn:=xlValues, lookat:=xlWhole)
Set r = Range("L:L").Find("DDY123478", LookIn:=xlValues, lookat:=xlWhole)
If Not r Is Nothing Then MsgBox s1, vbInformation + vbOKOnly, "Info" Else MsgBox s2, vbInformation + vbOKOnly, "Info"
End Sub

Open in new window

Kyle
SOLUTION
Avatar of kgerb
kgerb
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of Rob Henson
Rob Henson
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of wgraphics
wgraphics

ASKER

Holy cow you guys, so sorry for not responding. That entire project/question totally got sidetracked. My apologies!! If I ever get back to that project I will try what you have submitted for me. Meanwhile I split the points- Thanks!