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