Sub Makro1()
'
Dim Message, Title, Default, MyValue, MyDate
Dim c As Object
Dim Počet As Integer
Počet = 0
Message = "Zadej vyhledávané datum "
Title = "Vyhledávání 5místných čísel dle datumu"
Default = Format(Now, "dd.mm.yyyy")
On Error Resume Next
Do
MyDate = CDate(InputBox(Message, Title, Default))
Loop While Not Err = 0
Message = "Zadej pětimístné číslo"
Default = 12345
Do
MyValue = InputBox(Message, Title, Default)
Loop While Not Len(MyValue) = 5
For Each List In Sheets
With List
With .Range("E1", .Cells(.Rows.Count, "E").End(3))
b = .Address
Set c = .Find(MyValue, LookIn:=xlValues, LookAt:=xlWhole)
If Not c Is Nothing Then
firstAddress = c.Address
Do
If CLng(c.Offset(0, -4)) = CLng(MyDate) Then Počet = Počet + 1
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With
End With
Next List
Message = "Dne: " & MyDate & " bylo " & Počet & " případů čísla " & MyValue
MsgBox (Message)
End Sub
citovat