tech_boy Posted July 22, 2011 Share Posted July 22, 2011 (edited) Hello all, This is a relatively complex problem to explain, but i'll give it my best shot!OK... I have the following code:Public Sub LookUp(s)Dim vOurResultDim lookForlookFor = sWith Sheets("DATA").Range("comment") vOurResult = .Find(What:=lookFor, After:=.Cells(1, 1), LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False).Offset(0, 9)End WithIf vOurResult = 0 Then Exit Sub' Ends program if no comment present for this customerElse MsgBox vOurResult' Displays messagebox with corresponding commentEnd IfEnd SubThis basically runs a macro that looks through a hidden datasheet within an excel document which looks to see if any given customer has anything written in their "Comment" column; it it does, then it is displayed.My spreadsheet has a "Trailer Number" column and if someone enters a customer number adjacent to a particular set of trailer numbers, I need an error message to be displayed telling the user that they cannot use this kind of trailer and when they click "OK" the Customer ID field needs to be automatically wiped.I'm sorry if this explaination is terrible, please ask me for any extra information you may need!Thanks in advance, - Jon Edited July 22, 2011 by tech_boy Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now