View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mark1ace1[_7_] Mark1ace1[_7_] is offline
external usenet poster
 
Posts: 1
Default Excel VBA - Countif problem

Dim x As Long, y As Long, z As Long, searchstring As String
If ActiveCell = "" Then Exit Sub
searchstring = "DS45"
x = Range("I65536").End(xlUp).Row
y = Application.WorksheetFunction.CountIf(Range("I:I") , searchstring)
If y 3 Then
MsgBox "This Customer has reached their limit. Only 3 DVD's allowe
per customer!" & vbCrLf & vbCrLf & "Mark Smith - Manager"
vbInformation + vbOKOnly, "Disc Emporium - DVD Limit Check"
ActiveCell = ""
ActiveCell.Offset(, 5) = "On shelf"

I have the above formula which checks the search string for a value o
more than 3 entries, then brings up a message box...But, this work
fine, however, I have other strings that also needed to be checked..Ho
can I get the code to check more than one besides the "DS45"...I hav
20 or so more numbers in my datebase that I would like to check fo
greater than 3...Any help would be great

Thanks
Mar

--
Message posted from http://www.ExcelForum.com