SanjayGMusafir
Well-known Member
- Joined
- Sep 7, 2018
- Messages
- 1,503
- Office Version
- 2021
- Platform
- MacOS
Dear Expert
I have to filter my worksheet quite frequently on the basis of value in the last cell of a column. Please help me form a vba for that. I'm sharing the amount of work I was able to do... Thanks a lot ?
I have to filter my worksheet quite frequently on the basis of value in the last cell of a column. Please help me form a vba for that. I'm sharing the amount of work I was able to do... Thanks a lot ?
Rich (BB code):
Range("Visits[[#Headers],[Sr]]").Select
Dim varSr As String
Selection.End(xlDown).Select
Selection.End(xlDown).Select
Selection.End(xlUp).Select
varSr = Target.Value.Copy
'to use value of target cell - This thing not working
ActiveSheet.ListObjects("Visits").Range.AutoFilter Field:=1, Criteria1:=varSr, Operator:=xlAnd
'Old vba that was working well, but wanted to replace Cell address E1 with a target value
'ActiveSheet.ListObjects("Visits").Range.AutoFilter Field:=1, Criteria1:= _
Range("E1").Value, Operator:=xlAnd