Filter code works on text but not numbers

worlamptey

New Member
Joined
Jan 13, 2019
Messages
3
Hi All,

This is a similar question to another thread:https://www.mrexcel.com/forum/excel-questions/1081373-code-works-text-not-numbers.html

I've tried the solution suggested on the thread but still isn't working for me.

The column I am filtering on has numbers in text formats, such as "004", "032", "250" and also has cells contains alpha-numeric combinations, such as "2TX", "TZ7".

This is the part of the code where I am filtering on this column:

ActiveWorkbook.Sheets(Cstr(cell.Value)).Range("MasterData").AutoFilter Field:=6, Criteria1:="N<>" & CStr(cell.Value), Operator:=xlFilterValues.Offset(1, 0).SpecialCells(xlCellTypeVisible).EntireRow.DeleteEnd With

Does anyone knows of a way to make this filter work?
Or another way to filter out the rows I want to delete?

Thank you.
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
This is the entire code:

Sub SplitandFilterSheet()Dim Splitcode As RangeSheets("Master").SelectSet Splitcode = Range("Splitcode")For Each cell In SplitcodeSheets("Master").Copy After:=Worksheets(Sheets.Count)ActiveSheet.Name = cell.ValueWith ActiveWorkbook.Sheets(CStr(cell.Value)).Range("MasterData").AutoFilter Field:=6, Criteria1:="<>" & CStr(cell.Value), Operator:=xlFilterValues.Offset(1, 0).SpecialCells(xlCellTypeVisible).EntireRow.DeleteEnd WithActiveSheet.AutoFilter.ShowAllDataNext cellEnd Sub
 
Upvote 0
Code:
[COLOR=#0A0A0A][FONT=Roboto]Sub SplitandFilterSheet()
Dim Splitcode As RangeSheets("Master").Select
Set Splitcode = Range("Splitcode")
For Each cell In SplitcodeSheets("Master").Copy After:=Worksheets(Sheets.Count)
ActiveSheet.Name = cell.Value

With ActiveWorkbook.Sheets(CStr(cell.Value)).Range("MasterData")
.AutoFilter Field:=6, Criteria1:="<>" & CStr(cell.Value), Operator:=xlFilterValues
.Offset(1, 0).SpecialCells(xlCellTypeVisible).EntireRow.Delete

End With

ActiveSheet.AutoFilter.ShowAllData
Next cell

End Sub[/FONT][/COLOR]
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top