I made a code for filter by selected Cell value, to create an quick access toolbar icon and make it faster to filter. It worked perfectly when the filter started in column A. But some filters starts in columns B or C… and the value is filtered in another column, jumping the exact same number of blank columns tha has no filter. Do you guys know how to fix it? How to get the VBA to return the field number?
Sub Filtro_Valor_Célula() 'Filtra a coluna pelo valor da célula selecionada ' Valor = ActiveCell.Value ActiveSheet.Range(ActiveSheet.AutoFilter.Range.Address).AutoFilter Field:=ActiveCell.Column, Criteria1:=Valor End Sub