Autofilter - formatting criteria1 data for valid comparison

D

Dennis

2003

Procedure obtains a numeric value (NumbToReplace) from an input box.

The typical worksheet column format is:
NumberFormat = "#,##0.00_);(#,##0.00)" 'Number with 2 Dec Places

But the same column on other worksheets have format of:
NumberFormat = "#,##0.00000_);(#,##0.00000)" 'Number with 5

I format NumbToReplace as follows:
FilterCriteria = WorksheetFunction.Text(NumbToReplace, _
"#,##0.00_);(#,##0.00)")

Then I set the filter:
Filter1.AutoFilter Field:=4, Criteria1:="=" & FilterCriteria

The challenge: How to format "NumbToReplace" which becomes
"FilterCriteria" so that the filter is set properly no matter how many
decimal places the worksheet column has?

I am having a can't-see-the-forest-for-the-trees-moment even though the
answer is probably staring me right in the face..

TIA EagleOne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top