I wish to extract a selection of fields from one list in sheet1 to a target area in second sheet matching specified criteria. Basically, this is done using Excel Advanced Filter, specifying relevant arguments (looping through the list of criteria values).
rSourceRng.AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range(sFiltRng), CopyToRange:=WS2.Range(sDestRng), Unique:=True
Each criteria is a numeric values (following a standard Danish standard numeric format) formatted as text which applies also for the values listed in database.
The problem is that Filtercopy does not return those database records listed with criteria value below 7 characters (in this case values below 1.000.000).
Excel itself will gladly return all records matching the extract criteria. (Test by placing the curser in the target range before activating advanced filter). Note also, that the worksheet function =dcounta will return the correct number of records as well in VBA as in Excel.
Any ideas?
See code below and attachment.
Bookmarks