VBA 根据日期筛选数据

筛选两个日期间的全部数据Dim a, b, ca = Format(Date, "yyyy/m") '当前年月日MsgBox a '显示日期时间'当前月份加4b = DateAdd("m", 4, a)Debug.Print bDim Rng As Range, arr As VariantDim EndRow As Long, EndCol As LongDim Rngtime As RangeWith Sheets("PM") '获取A列最后一行(非空行)的行...
摘要由CSDN通过智能技术生成

筛选两个日期间的全部数据

Dim a, b, c
a = Format(Date, "yyyy/m") '当前年月日

MsgBox a  '显示日期时间

'当前月份加4
b = DateAdd("m", 4, a)

Debug.Print b

Dim Rng As Range, arr As Variant
Dim EndRow As Long, EndCol As Long
Dim Rngtime As Range
With Sheets("PM")

     '获取A列最后一行(非空行)的行号
        EndRow = .Cells(.Cells.Rows.Count, 1).End(xlUp).Row
       
        '获取第一行最后一列(非空列)的列号
        EndCol = .Cells(1, .Cells.Columns.Count).End(xlToLeft).Column
       
        '保存数据
        Set Rng = .Range(.Cells(1, 1), .Cells(EndRow, EndCol))
        '存入数组
        arr = Rng.Value
        'end time
'        Set Rngtime = .Range(.Cells(1, 3), .Cells(EndRow, 3))
 End With
       
        
        
'    循环筛选符合条件的数据
'
'    重新

  • 2
    点赞
  • 19
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值