简体   繁体   English

寻找今天在excel vba中的日期之间列出的vba代码

[英]looking for vba code to list today between no of dates in excel vba

I have a excel file with a schedule of date wise samples up to 3 years.我有一个 excel 文件,其中包含长达 3 年的日期样本计划。 In that sheet how to find a today samples as a popup alert in VBA在该工作表中,如何在 VBA 中找到今天的样本作为弹出警报

Please help me.请帮我。

So far as i think, this might ful-fill your purpose, this is a macro code in which it would ask the user to enter the date it want to search in a particular column, you can change the column by changing Range("A:A") to whatever you prefer.就我而言,这可能会实现您的目的,这是一个宏代码,它会要求用户在特定列中输入要搜索的日期,您可以通过更改 Range("A :A") 到您喜欢的任何内容。

Sub Find_Date()
Dim FindString As Date
Dim Rng As Range
FindString = InputBox("Please Enter Date")
If Trim(FindString) <> "" Then
        With ActiveWorkbook.ActiveSheet.Range("A:A")
        Set Rng = .Find(What:=FindString, _
                        After:=.Cells(.Cells.Count), _
                        LookIn:=xlValues, _
                        LookAt:=xlWhole, _
                        SearchOrder:=xlByRows, _
                        SearchDirection:=xlNext, _
                        MatchCase:=False)
        If Not Rng Is Nothing Then
            Application.Goto Rng, True
        Else
            MsgBox "Nothing found"
        End If
    End With
End If

End Sub结束子

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM