Is it possible to query a worksheet using VBA?
I want to be able to select all the values in the time column i.e. (00:00) WHERE the day equals for example: Saturday
I there any way to do this, a tutorial would be really helpful.
Thanks
You can programmtically create an AutoFilter, then select the matching values:
Dim ws As Worksheet: Set ws = ActiveSheet
With ws
.AutoFilterMode = False
.Range("1:1").AutoFilter
.Range("1:1").AutoFilter field:=2, Criteria1:="=Saturday", Operator:=xlAnd
With .AutoFilter.Range
On Error Resume Next ' if none selected
.Offset(1).Resize(.Rows.Count - 1).Columns(2).SpecialCells(xlCellTypeVisible).Select
On Error GoTo 0
End With
.AutoFilterMode = False
End With
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With