LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default AdvancedFilter

Using the following code AdvancedFilter is working except where the filter is
set to 'D' on a particular column the returned set contains all rows where
that column starts with a 'D' i.e. D, Dad, Dolphin .... I need the returned
to be limited to the rows where column contains exactly 'D'.

Sub AllColumnsOneCustomer()
' Page 227
Dim IRange As Range
Dim ORange As Range
Dim CRange As Range

' Since this is called from a button on Menu,
' first select the sample data sheet
Worksheets("DBSize").Select
' Clear out results of previous macros
Range("G1:M50").EntireColumn.Delete

' Find the size of today's dataset
FinalRow = Cells(65536, 1).End(xlUp).Row
NextCol = Cells(1, 255).End(xlToLeft).Column + 2

' Set up the Criteria Range with one customer
Cells(1, NextCol).Value = Range("D1").Value
' In reality, this value should be passed from the userform
Cells(2, NextCol).Value = "D"
Set CRange = Cells(1, NextCol).Resize(2, 1)

' Set up output range. It is a single blank cell
Set ORange = Cells(1, NextCol + 2)

' Define the Input Range
Set IRange = Range("A1").Resize(FinalRow, NextCol - 2)

' Do the Advanced Filter to get unique list of customers & product
IRange.AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=CRange,
CopyToRange:=ORange
' Range("L1").Select

End Sub
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Advancedfilter ram Excel Programming 1 December 30th 05 02:18 AM
AdvancedFilter with VBA newToExcel Excel Programming 2 September 30th 05 05:20 PM
AdvancedFilter in VB loopy[_6_] Excel Programming 1 June 22nd 05 03:24 PM
AdvancedFilter to Array Witek[_2_] Excel Programming 0 April 23rd 05 07:19 PM
Help with AdvancedFilter method Sumanth Suri Excel Programming 1 November 21st 03 06:02 AM


All times are GMT +1. The time now is 01:51 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"