问题
I want to filter a multipleColumnRange by column1 if a cell.Text starts with "A"
rng01.Columns(1).AutoFilter Field:=1, Criteria1:="firstCharacter = 'A'", VisibleDropDown:=False
How could I do this, pls ?
回答1:
Something like this.
The first three lines were used for my test code.
Dim rng01 As Range
Set rng01 = [a1:c10]
rng01.Parent.AutoFilterMode = False
rng01.Columns(1).AutoFilter Field:=1, Criteria1:="=A*", VisibleDropDown:=False
回答2:
The easiest way would be to create an additional column with the first character of the words in column 1:
=LEFT(A1,1)
And filter on that new column.
来源:https://stackoverflow.com/questions/12881214/how-to-filter-a-range-by-first-character-in-a-cell