以下是用VBA编写的代码:

Sub CheckDates()
    Dim ws As Worksheet
    Dim lastRow As Long
    Dim currentDate As Date
    Dim i As Long
    
    Set ws = ThisWorkbook.Sheets("Sheet1") ' 更改为你的表格名称
    lastRow = ws.Cells(ws.Rows.Count, "AE").End(xlUp).Row ' 获取AE列的最后一行
    currentDate = Date ' 当前日期
    
    For i = 2 To lastRow ' 从第二行开始循环,跳过标题行
        If ws.Range("AE" & i).Value = "抵押" And ws.Range("AD" & i).Value = "" Then ' 检查条件
            If ws.Range("X" & i).Value - currentDate < 20 Then ' 比较日期
                MsgBox "日期小于20天的单元格为:" & ws.Range("X" & i).Address ' 弹窗提示并定位到单元格
            End If
        End If
    Next i
End Sub

请将代码复制到VBA编辑器中的模块中,然后运行CheckDates子过程。它将在满足条件的单元格中找到日期小于20天的单元格,并弹出提示框显示单元格的地址

检查Sheet1表格中列AE与列AD。如果为列AE为抵押列AD为空则检查列X日期与当前日期比较如小于20天弹窗提示在哪个单元格并定位到此单元格。用VBA编写

原文地址: http://www.cveoy.top/t/topic/iWtT 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录