FileDateTime , enable/disable filter

  • FileDateTime: get the latest modified datetime of a file
  • .AutoFilterMode = False: disable filter

.Range(“A1”).AutoFilter Field:=1, Criteria1:=“11”

  • if filter is enabled, condition of the first filter will be set to =“11”
  • if no filter is enabled, the table containing “A1” will be set filter,and condition of the first filter will be set to =“11”
Sub test1()
	Set x = ThisWorkbook.Sheets("xx")
	Dim i As Long, Title As String
	With x
	    'オートフィルタが適用されているか判定
	    If .AutoFilterMode Then
	        'オートフィルタの列数
	        For i = 1 To .AutoFilter.Filters.Count
	            '絞り込みされているか判定
	            If .AutoFilter.Filters(i).On Then
	                '全てを表示
	                .AutoFilter.ShowAllData
	                Exit For
	            End If
	        Next i
	    End If
	End With
End Sub

Sub test2()
	Set x = ThisWorkbook.Sheets("xx")
	a = FileDateTime("C:\Users\XXXXXX\Desktop\click.xlsm")
	Debug.Print a
End Sub

Sub test3()
	Set x = ThisWorkbook.Sheets("xx")
	With x
	    .AutoFilterMode = False
	    'Sheet1のA1のアクティブ セル領域の1列目を"1"で絞り込み
	    .Range("A1").AutoFilter Field:=1, Criteria1:="11"
	    'Sheet2へコピー
	    .Range("A1").CurrentRegion.Copy
	    Sheets("Sheet2").Range("A1").PasteSpecial Paste:=xlPasteValues
	    'オートフィルタを解除
	    .AutoFilterMode = False
	End With
	Application.CutCopyMode = False
End Sub

Sub test4()
	Set x = ThisWorkbook.Sheets("xx")
	x.Range("A21").CurrentRegion.Select
End Sub
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值