View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett[_4_] Don Guillett[_4_] is offline
external usenet poster
 
Posts: 2,337
Default Excel VBA - Countif problem

Here's an idea for you
Sub morethan3()
For Each c In Range("k2,L1,m5")
If c 3 Then MsgBox c.Address
Next
End Sub
--
Don Guillett
SalesAid Software

"Mark1ace1 " wrote in message
...
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 allowed
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 of
more than 3 entries, then brings up a message box...But, this works
fine, however, I have other strings that also needed to be checked..How
can I get the code to check more than one besides the "DS45"...I have
20 or so more numbers in my datebase that I would like to check for
greater than 3...Any help would be great

Thanks
Mark


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