PC Review


Reply
Thread Tools Rate Thread

Autofilter - delete filtered selection

 
 
Albert
Guest
Posts: n/a
 
      31st Jan 2008
Hi Guys,

I have been using the following code (courtesy of Ron debruin):

Sub Copy_With_AutoFilter1()
Dim ws As Worksheet
Dim WSNew As Worksheet
Dim rng As Range
Dim rng2 As Range
Dim rng3 As Range
Dim sourceRange As Range
Dim destrange As Range
Dim destWB As Workbook
Dim DestSh As Worksheet
Dim Lr As Long
Dim sourceWB As Workbook

With Application
.ScreenUpdating = False
.EnableEvents = False
End With


If bIsBookOpen("Test DB.xlsm") Then
Set destWB = Workbooks("Test DB.xlsm")
Else
Set destWB = Workbooks.Open("K:\Customer services screen\Test
Database\Test DB.xlsm")
End If

Set ws = destWB.Sheets("Sheet1")


Set rng = ws.Range("A1:ab" & Rows.Count)
FieldNum = 1
ws.AutoFilterMode = False

On Error Resume Next
Application.DisplayAlerts = False
Sheets("MyFilterResult").Delete
Application.DisplayAlerts = True
On Error GoTo 0

rng.AutoFilter Field:=3, Criteria1:="=" & ComboBoxCustomerAgent.Value
rng.AutoFilter Field:=14, Criteria1:="=" & DTPicker1.Value
rng.AutoFilter Field:=18, Criteria1:="= Open"

Set WSNew = Workbooks("Customer services test.xlsm").Worksheets("Sheet2")

ws.AutoFilter.Range.Copy

With WSNew.Range("A1")
.PasteSpecial Paste:=8
.PasteSpecial xlPasteValues
.PasteSpecial xlPasteFormats
'
Application.CutCopyMode = False
TextBoxWorkfortoday.Text = Cells(Rows.Count, 1).End(xlUp).Row - 1

End With
'
With ws.AutoFilter.Range
On Error Resume Next
Set rng2 = .Offset(1, 0).Resize(.Rows.Count - 1, .Columns.Count) _
.SpecialCells(xlCellTypeVisible)
On Error GoTo 0
If Not rng2 Is Nothing Then rng2.EntireRow.Delete
End With

ws.AutoFilterMode = False
destWB.Close SaveChanges:=True
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
Workbooks("Customer services test.xlsm").Worksheets("Sheet1").Activate
End Sub

I have 2 questions:
The autofilter is not filtering on all criteria?
And then not deleting those records that were filtered?

Any help?

Thanks
Albert
 
Reply With Quote
 
 
 
 
Ron de Bruin
Guest
Posts: n/a
 
      31st Jan 2008
hi Albert

Working with = in Autofilter can give problems if you filter on one date

Try this

rng.AutoFilter Field:=14, Criteria1:=">=" & CLng( DTPicker1.Value), _
Operator:=xlAnd, Criteria2:="<=" & CLng( DTPicker1.Value)



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Albert" <(E-Mail Removed)> wrote in message news:70EC317C-980E-442D-B466-(E-Mail Removed)...
> Hi Guys,
>
> I have been using the following code (courtesy of Ron debruin):
>
> Sub Copy_With_AutoFilter1()
> Dim ws As Worksheet
> Dim WSNew As Worksheet
> Dim rng As Range
> Dim rng2 As Range
> Dim rng3 As Range
> Dim sourceRange As Range
> Dim destrange As Range
> Dim destWB As Workbook
> Dim DestSh As Worksheet
> Dim Lr As Long
> Dim sourceWB As Workbook
>
> With Application
> .ScreenUpdating = False
> .EnableEvents = False
> End With
>
>
> If bIsBookOpen("Test DB.xlsm") Then
> Set destWB = Workbooks("Test DB.xlsm")
> Else
> Set destWB = Workbooks.Open("K:\Customer services screen\Test
> Database\Test DB.xlsm")
> End If
>
> Set ws = destWB.Sheets("Sheet1")
>
>
> Set rng = ws.Range("A1:ab" & Rows.Count)
> FieldNum = 1
> ws.AutoFilterMode = False
>
> On Error Resume Next
> Application.DisplayAlerts = False
> Sheets("MyFilterResult").Delete
> Application.DisplayAlerts = True
> On Error GoTo 0
>
> rng.AutoFilter Field:=3, Criteria1:="=" & ComboBoxCustomerAgent.Value
> rng.AutoFilter Field:=14, Criteria1:="=" & DTPicker1.Value
> rng.AutoFilter Field:=18, Criteria1:="= Open"
>
> Set WSNew = Workbooks("Customer services test.xlsm").Worksheets("Sheet2")
>
> ws.AutoFilter.Range.Copy
>
> With WSNew.Range("A1")
> .PasteSpecial Paste:=8
> .PasteSpecial xlPasteValues
> .PasteSpecial xlPasteFormats
> '
> Application.CutCopyMode = False
> TextBoxWorkfortoday.Text = Cells(Rows.Count, 1).End(xlUp).Row - 1
>
> End With
> '
> With ws.AutoFilter.Range
> On Error Resume Next
> Set rng2 = .Offset(1, 0).Resize(.Rows.Count - 1, .Columns.Count) _
> .SpecialCells(xlCellTypeVisible)
> On Error GoTo 0
> If Not rng2 Is Nothing Then rng2.EntireRow.Delete
> End With
>
> ws.AutoFilterMode = False
> destWB.Close SaveChanges:=True
> With Application
> .ScreenUpdating = True
> .EnableEvents = True
> End With
> Workbooks("Customer services test.xlsm").Worksheets("Sheet1").Activate
> End Sub
>
> I have 2 questions:
> The autofilter is not filtering on all criteria?
> And then not deleting those records that were filtered?
>
> Any help?
>
> Thanks
> Albert

 
Reply With Quote
 
Albert
Guest
Posts: n/a
 
      1st Feb 2008
Hi Ron,

It does not seem to work. Any other ideas. I will try during the day and let
you know to my progress.

Thanks
Albert

"Ron de Bruin" wrote:

> hi Albert
>
> Working with = in Autofilter can give problems if you filter on one date
>
> Try this
>
> rng.AutoFilter Field:=14, Criteria1:=">=" & CLng( DTPicker1.Value), _
> Operator:=xlAnd, Criteria2:="<=" & CLng( DTPicker1.Value)
>
>
>
> --
>
> Regards Ron de Bruin
> http://www.rondebruin.nl/tips.htm
>
>
> "Albert" <(E-Mail Removed)> wrote in message news:70EC317C-980E-442D-B466-(E-Mail Removed)...
> > Hi Guys,
> >
> > I have been using the following code (courtesy of Ron debruin):
> >
> > Sub Copy_With_AutoFilter1()
> > Dim ws As Worksheet
> > Dim WSNew As Worksheet
> > Dim rng As Range
> > Dim rng2 As Range
> > Dim rng3 As Range
> > Dim sourceRange As Range
> > Dim destrange As Range
> > Dim destWB As Workbook
> > Dim DestSh As Worksheet
> > Dim Lr As Long
> > Dim sourceWB As Workbook
> >
> > With Application
> > .ScreenUpdating = False
> > .EnableEvents = False
> > End With
> >
> >
> > If bIsBookOpen("Test DB.xlsm") Then
> > Set destWB = Workbooks("Test DB.xlsm")
> > Else
> > Set destWB = Workbooks.Open("K:\Customer services screen\Test
> > Database\Test DB.xlsm")
> > End If
> >
> > Set ws = destWB.Sheets("Sheet1")
> >
> >
> > Set rng = ws.Range("A1:ab" & Rows.Count)
> > FieldNum = 1
> > ws.AutoFilterMode = False
> >
> > On Error Resume Next
> > Application.DisplayAlerts = False
> > Sheets("MyFilterResult").Delete
> > Application.DisplayAlerts = True
> > On Error GoTo 0
> >
> > rng.AutoFilter Field:=3, Criteria1:="=" & ComboBoxCustomerAgent.Value
> > rng.AutoFilter Field:=14, Criteria1:="=" & DTPicker1.Value
> > rng.AutoFilter Field:=18, Criteria1:="= Open"
> >
> > Set WSNew = Workbooks("Customer services test.xlsm").Worksheets("Sheet2")
> >
> > ws.AutoFilter.Range.Copy
> >
> > With WSNew.Range("A1")
> > .PasteSpecial Paste:=8
> > .PasteSpecial xlPasteValues
> > .PasteSpecial xlPasteFormats
> > '
> > Application.CutCopyMode = False
> > TextBoxWorkfortoday.Text = Cells(Rows.Count, 1).End(xlUp).Row - 1
> >
> > End With
> > '
> > With ws.AutoFilter.Range
> > On Error Resume Next
> > Set rng2 = .Offset(1, 0).Resize(.Rows.Count - 1, .Columns.Count) _
> > .SpecialCells(xlCellTypeVisible)
> > On Error GoTo 0
> > If Not rng2 Is Nothing Then rng2.EntireRow.Delete
> > End With
> >
> > ws.AutoFilterMode = False
> > destWB.Close SaveChanges:=True
> > With Application
> > .ScreenUpdating = True
> > .EnableEvents = True
> > End With
> > Workbooks("Customer services test.xlsm").Worksheets("Sheet1").Activate
> > End Sub
> >
> > I have 2 questions:
> > The autofilter is not filtering on all criteria?
> > And then not deleting those records that were filtered?
> >
> > Any help?
> >
> > Thanks
> > Albert

>

 
Reply With Quote
 
Albert
Guest
Posts: n/a
 
      1st Feb 2008
Hi Ron,

It only seems to be filtering on one criteria? Have I entered the code
correctly?

Thanks
Albert

"Albert" wrote:

> Hi Ron,
>
> It does not seem to work. Any other ideas. I will try during the day and let
> you know to my progress.
>
> Thanks
> Albert
>
> "Ron de Bruin" wrote:
>
> > hi Albert
> >
> > Working with = in Autofilter can give problems if you filter on one date
> >
> > Try this
> >
> > rng.AutoFilter Field:=14, Criteria1:=">=" & CLng( DTPicker1.Value), _
> > Operator:=xlAnd, Criteria2:="<=" & CLng( DTPicker1.Value)
> >
> >
> >
> > --
> >
> > Regards Ron de Bruin
> > http://www.rondebruin.nl/tips.htm
> >
> >
> > "Albert" <(E-Mail Removed)> wrote in message news:70EC317C-980E-442D-B466-(E-Mail Removed)...
> > > Hi Guys,
> > >
> > > I have been using the following code (courtesy of Ron debruin):
> > >
> > > Sub Copy_With_AutoFilter1()
> > > Dim ws As Worksheet
> > > Dim WSNew As Worksheet
> > > Dim rng As Range
> > > Dim rng2 As Range
> > > Dim rng3 As Range
> > > Dim sourceRange As Range
> > > Dim destrange As Range
> > > Dim destWB As Workbook
> > > Dim DestSh As Worksheet
> > > Dim Lr As Long
> > > Dim sourceWB As Workbook
> > >
> > > With Application
> > > .ScreenUpdating = False
> > > .EnableEvents = False
> > > End With
> > >
> > >
> > > If bIsBookOpen("Test DB.xlsm") Then
> > > Set destWB = Workbooks("Test DB.xlsm")
> > > Else
> > > Set destWB = Workbooks.Open("K:\Customer services screen\Test
> > > Database\Test DB.xlsm")
> > > End If
> > >
> > > Set ws = destWB.Sheets("Sheet1")
> > >
> > >
> > > Set rng = ws.Range("A1:ab" & Rows.Count)
> > > FieldNum = 1
> > > ws.AutoFilterMode = False
> > >
> > > On Error Resume Next
> > > Application.DisplayAlerts = False
> > > Sheets("MyFilterResult").Delete
> > > Application.DisplayAlerts = True
> > > On Error GoTo 0
> > >
> > > rng.AutoFilter Field:=3, Criteria1:="=" & ComboBoxCustomerAgent.Value
> > > rng.AutoFilter Field:=14, Criteria1:="=" & DTPicker1.Value
> > > rng.AutoFilter Field:=18, Criteria1:="= Open"
> > >
> > > Set WSNew = Workbooks("Customer services test.xlsm").Worksheets("Sheet2")
> > >
> > > ws.AutoFilter.Range.Copy
> > >
> > > With WSNew.Range("A1")
> > > .PasteSpecial Paste:=8
> > > .PasteSpecial xlPasteValues
> > > .PasteSpecial xlPasteFormats
> > > '
> > > Application.CutCopyMode = False
> > > TextBoxWorkfortoday.Text = Cells(Rows.Count, 1).End(xlUp).Row - 1
> > >
> > > End With
> > > '
> > > With ws.AutoFilter.Range
> > > On Error Resume Next
> > > Set rng2 = .Offset(1, 0).Resize(.Rows.Count - 1, .Columns.Count) _
> > > .SpecialCells(xlCellTypeVisible)
> > > On Error GoTo 0
> > > If Not rng2 Is Nothing Then rng2.EntireRow.Delete
> > > End With
> > >
> > > ws.AutoFilterMode = False
> > > destWB.Close SaveChanges:=True
> > > With Application
> > > .ScreenUpdating = True
> > > .EnableEvents = True
> > > End With
> > > Workbooks("Customer services test.xlsm").Worksheets("Sheet1").Activate
> > > End Sub
> > >
> > > I have 2 questions:
> > > The autofilter is not filtering on all criteria?
> > > And then not deleting those records that were filtered?
> > >
> > > Any help?
> > >
> > > Thanks
> > > Albert

> >

 
Reply With Quote
 
Ron de Bruin
Guest
Posts: n/a
 
      1st Feb 2008
You need the other two filter lines also

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Albert" <(E-Mail Removed)> wrote in message news:826A33EC-B0B6-45FE-A4D0-(E-Mail Removed)...
> Hi Ron,
>
> It only seems to be filtering on one criteria? Have I entered the code
> correctly?
>
> Thanks
> Albert
>
> "Albert" wrote:
>
>> Hi Ron,
>>
>> It does not seem to work. Any other ideas. I will try during the day and let
>> you know to my progress.
>>
>> Thanks
>> Albert
>>
>> "Ron de Bruin" wrote:
>>
>> > hi Albert
>> >
>> > Working with = in Autofilter can give problems if you filter on one date
>> >
>> > Try this
>> >
>> > rng.AutoFilter Field:=14, Criteria1:=">=" & CLng( DTPicker1.Value), _
>> > Operator:=xlAnd, Criteria2:="<=" & CLng( DTPicker1.Value)
>> >
>> >
>> >
>> > --
>> >
>> > Regards Ron de Bruin
>> > http://www.rondebruin.nl/tips.htm
>> >
>> >
>> > "Albert" <(E-Mail Removed)> wrote in message news:70EC317C-980E-442D-B466-(E-Mail Removed)...
>> > > Hi Guys,
>> > >
>> > > I have been using the following code (courtesy of Ron debruin):
>> > >
>> > > Sub Copy_With_AutoFilter1()
>> > > Dim ws As Worksheet
>> > > Dim WSNew As Worksheet
>> > > Dim rng As Range
>> > > Dim rng2 As Range
>> > > Dim rng3 As Range
>> > > Dim sourceRange As Range
>> > > Dim destrange As Range
>> > > Dim destWB As Workbook
>> > > Dim DestSh As Worksheet
>> > > Dim Lr As Long
>> > > Dim sourceWB As Workbook
>> > >
>> > > With Application
>> > > .ScreenUpdating = False
>> > > .EnableEvents = False
>> > > End With
>> > >
>> > >
>> > > If bIsBookOpen("Test DB.xlsm") Then
>> > > Set destWB = Workbooks("Test DB.xlsm")
>> > > Else
>> > > Set destWB = Workbooks.Open("K:\Customer services screen\Test
>> > > Database\Test DB.xlsm")
>> > > End If
>> > >
>> > > Set ws = destWB.Sheets("Sheet1")
>> > >
>> > >
>> > > Set rng = ws.Range("A1:ab" & Rows.Count)
>> > > FieldNum = 1
>> > > ws.AutoFilterMode = False
>> > >
>> > > On Error Resume Next
>> > > Application.DisplayAlerts = False
>> > > Sheets("MyFilterResult").Delete
>> > > Application.DisplayAlerts = True
>> > > On Error GoTo 0
>> > >
>> > > rng.AutoFilter Field:=3, Criteria1:="=" & ComboBoxCustomerAgent.Value
>> > > rng.AutoFilter Field:=14, Criteria1:="=" & DTPicker1.Value
>> > > rng.AutoFilter Field:=18, Criteria1:="= Open"
>> > >
>> > > Set WSNew = Workbooks("Customer services test.xlsm").Worksheets("Sheet2")
>> > >
>> > > ws.AutoFilter.Range.Copy
>> > >
>> > > With WSNew.Range("A1")
>> > > .PasteSpecial Paste:=8
>> > > .PasteSpecial xlPasteValues
>> > > .PasteSpecial xlPasteFormats
>> > > '
>> > > Application.CutCopyMode = False
>> > > TextBoxWorkfortoday.Text = Cells(Rows.Count, 1).End(xlUp).Row - 1
>> > >
>> > > End With
>> > > '
>> > > With ws.AutoFilter.Range
>> > > On Error Resume Next
>> > > Set rng2 = .Offset(1, 0).Resize(.Rows.Count - 1, .Columns.Count) _
>> > > .SpecialCells(xlCellTypeVisible)
>> > > On Error GoTo 0
>> > > If Not rng2 Is Nothing Then rng2.EntireRow.Delete
>> > > End With
>> > >
>> > > ws.AutoFilterMode = False
>> > > destWB.Close SaveChanges:=True
>> > > With Application
>> > > .ScreenUpdating = True
>> > > .EnableEvents = True
>> > > End With
>> > > Workbooks("Customer services test.xlsm").Worksheets("Sheet1").Activate
>> > > End Sub
>> > >
>> > > I have 2 questions:
>> > > The autofilter is not filtering on all criteria?
>> > > And then not deleting those records that were filtered?
>> > >
>> > > Any help?
>> > >
>> > > Thanks
>> > > Albert
>> >

 
Reply With Quote
 
Albert
Guest
Posts: n/a
 
      1st Feb 2008
I have tried the extra lines, but still no luck.

I have substituted your code for autofilter field=14

It returns nothing if all filters are in place. If I block out field 14 and
18 it works but not if all 3 are active

"Ron de Bruin" wrote:

> You need the other two filter lines also
>
> --
>
> Regards Ron de Bruin
> http://www.rondebruin.nl/tips.htm
>
>
> "Albert" <(E-Mail Removed)> wrote in message news:826A33EC-B0B6-45FE-A4D0-(E-Mail Removed)...
> > Hi Ron,
> >
> > It only seems to be filtering on one criteria? Have I entered the code
> > correctly?
> >
> > Thanks
> > Albert
> >
> > "Albert" wrote:
> >
> >> Hi Ron,
> >>
> >> It does not seem to work. Any other ideas. I will try during the day and let
> >> you know to my progress.
> >>
> >> Thanks
> >> Albert
> >>
> >> "Ron de Bruin" wrote:
> >>
> >> > hi Albert
> >> >
> >> > Working with = in Autofilter can give problems if you filter on one date
> >> >
> >> > Try this
> >> >
> >> > rng.AutoFilter Field:=14, Criteria1:=">=" & CLng( DTPicker1.Value), _
> >> > Operator:=xlAnd, Criteria2:="<=" & CLng( DTPicker1.Value)
> >> >
> >> >
> >> >
> >> > --
> >> >
> >> > Regards Ron de Bruin
> >> > http://www.rondebruin.nl/tips.htm
> >> >
> >> >
> >> > "Albert" <(E-Mail Removed)> wrote in message news:70EC317C-980E-442D-B466-(E-Mail Removed)...
> >> > > Hi Guys,
> >> > >
> >> > > I have been using the following code (courtesy of Ron debruin):
> >> > >
> >> > > Sub Copy_With_AutoFilter1()
> >> > > Dim ws As Worksheet
> >> > > Dim WSNew As Worksheet
> >> > > Dim rng As Range
> >> > > Dim rng2 As Range
> >> > > Dim rng3 As Range
> >> > > Dim sourceRange As Range
> >> > > Dim destrange As Range
> >> > > Dim destWB As Workbook
> >> > > Dim DestSh As Worksheet
> >> > > Dim Lr As Long
> >> > > Dim sourceWB As Workbook
> >> > >
> >> > > With Application
> >> > > .ScreenUpdating = False
> >> > > .EnableEvents = False
> >> > > End With
> >> > >
> >> > >
> >> > > If bIsBookOpen("Test DB.xlsm") Then
> >> > > Set destWB = Workbooks("Test DB.xlsm")
> >> > > Else
> >> > > Set destWB = Workbooks.Open("K:\Customer services screen\Test
> >> > > Database\Test DB.xlsm")
> >> > > End If
> >> > >
> >> > > Set ws = destWB.Sheets("Sheet1")
> >> > >
> >> > >
> >> > > Set rng = ws.Range("A1:ab" & Rows.Count)
> >> > > FieldNum = 1
> >> > > ws.AutoFilterMode = False
> >> > >
> >> > > On Error Resume Next
> >> > > Application.DisplayAlerts = False
> >> > > Sheets("MyFilterResult").Delete
> >> > > Application.DisplayAlerts = True
> >> > > On Error GoTo 0
> >> > >
> >> > > rng.AutoFilter Field:=3, Criteria1:="=" & ComboBoxCustomerAgent.Value
> >> > > rng.AutoFilter Field:=14, Criteria1:="=" & DTPicker1.Value
> >> > > rng.AutoFilter Field:=18, Criteria1:="= Open"
> >> > >
> >> > > Set WSNew = Workbooks("Customer services test.xlsm").Worksheets("Sheet2")
> >> > >
> >> > > ws.AutoFilter.Range.Copy
> >> > >
> >> > > With WSNew.Range("A1")
> >> > > .PasteSpecial Paste:=8
> >> > > .PasteSpecial xlPasteValues
> >> > > .PasteSpecial xlPasteFormats
> >> > > '
> >> > > Application.CutCopyMode = False
> >> > > TextBoxWorkfortoday.Text = Cells(Rows.Count, 1).End(xlUp).Row - 1
> >> > >
> >> > > End With
> >> > > '
> >> > > With ws.AutoFilter.Range
> >> > > On Error Resume Next
> >> > > Set rng2 = .Offset(1, 0).Resize(.Rows.Count - 1, .Columns.Count) _
> >> > > .SpecialCells(xlCellTypeVisible)
> >> > > On Error GoTo 0
> >> > > If Not rng2 Is Nothing Then rng2.EntireRow.Delete
> >> > > End With
> >> > >
> >> > > ws.AutoFilterMode = False
> >> > > destWB.Close SaveChanges:=True
> >> > > With Application
> >> > > .ScreenUpdating = True
> >> > > .EnableEvents = True
> >> > > End With
> >> > > Workbooks("Customer services test.xlsm").Worksheets("Sheet1").Activate
> >> > > End Sub
> >> > >
> >> > > I have 2 questions:
> >> > > The autofilter is not filtering on all criteria?
> >> > > And then not deleting those records that were filtered?
> >> > >
> >> > > Any help?
> >> > >
> >> > > Thanks
> >> > > Albert
> >> >

>

 
Reply With Quote
 
Ron de Bruin
Guest
Posts: n/a
 
      1st Feb 2008
Hi Albert

I never work with a DTPicker1.
But if you send me your test file private I will look at it this weekend

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Albert" <(E-Mail Removed)> wrote in message news:230B4F3E-07CB-4FF2-B692-(E-Mail Removed)...
>I have tried the extra lines, but still no luck.
>
> I have substituted your code for autofilter field=14
>
> It returns nothing if all filters are in place. If I block out field 14 and
> 18 it works but not if all 3 are active
>
> "Ron de Bruin" wrote:
>
>> You need the other two filter lines also
>>
>> --
>>
>> Regards Ron de Bruin
>> http://www.rondebruin.nl/tips.htm
>>
>>
>> "Albert" <(E-Mail Removed)> wrote in message news:826A33EC-B0B6-45FE-A4D0-(E-Mail Removed)...
>> > Hi Ron,
>> >
>> > It only seems to be filtering on one criteria? Have I entered the code
>> > correctly?
>> >
>> > Thanks
>> > Albert
>> >
>> > "Albert" wrote:
>> >
>> >> Hi Ron,
>> >>
>> >> It does not seem to work. Any other ideas. I will try during the day and let
>> >> you know to my progress.
>> >>
>> >> Thanks
>> >> Albert
>> >>
>> >> "Ron de Bruin" wrote:
>> >>
>> >> > hi Albert
>> >> >
>> >> > Working with = in Autofilter can give problems if you filter on one date
>> >> >
>> >> > Try this
>> >> >
>> >> > rng.AutoFilter Field:=14, Criteria1:=">=" & CLng( DTPicker1.Value), _
>> >> > Operator:=xlAnd, Criteria2:="<=" & CLng( DTPicker1.Value)
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> >
>> >> > Regards Ron de Bruin
>> >> > http://www.rondebruin.nl/tips.htm
>> >> >
>> >> >
>> >> > "Albert" <(E-Mail Removed)> wrote in message news:70EC317C-980E-442D-B466-(E-Mail Removed)...
>> >> > > Hi Guys,
>> >> > >
>> >> > > I have been using the following code (courtesy of Ron debruin):
>> >> > >
>> >> > > Sub Copy_With_AutoFilter1()
>> >> > > Dim ws As Worksheet
>> >> > > Dim WSNew As Worksheet
>> >> > > Dim rng As Range
>> >> > > Dim rng2 As Range
>> >> > > Dim rng3 As Range
>> >> > > Dim sourceRange As Range
>> >> > > Dim destrange As Range
>> >> > > Dim destWB As Workbook
>> >> > > Dim DestSh As Worksheet
>> >> > > Dim Lr As Long
>> >> > > Dim sourceWB As Workbook
>> >> > >
>> >> > > With Application
>> >> > > .ScreenUpdating = False
>> >> > > .EnableEvents = False
>> >> > > End With
>> >> > >
>> >> > >
>> >> > > If bIsBookOpen("Test DB.xlsm") Then
>> >> > > Set destWB = Workbooks("Test DB.xlsm")
>> >> > > Else
>> >> > > Set destWB = Workbooks.Open("K:\Customer services screen\Test
>> >> > > Database\Test DB.xlsm")
>> >> > > End If
>> >> > >
>> >> > > Set ws = destWB.Sheets("Sheet1")
>> >> > >
>> >> > >
>> >> > > Set rng = ws.Range("A1:ab" & Rows.Count)
>> >> > > FieldNum = 1
>> >> > > ws.AutoFilterMode = False
>> >> > >
>> >> > > On Error Resume Next
>> >> > > Application.DisplayAlerts = False
>> >> > > Sheets("MyFilterResult").Delete
>> >> > > Application.DisplayAlerts = True
>> >> > > On Error GoTo 0
>> >> > >
>> >> > > rng.AutoFilter Field:=3, Criteria1:="=" & ComboBoxCustomerAgent.Value
>> >> > > rng.AutoFilter Field:=14, Criteria1:="=" & DTPicker1.Value
>> >> > > rng.AutoFilter Field:=18, Criteria1:="= Open"
>> >> > >
>> >> > > Set WSNew = Workbooks("Customer services test.xlsm").Worksheets("Sheet2")
>> >> > >
>> >> > > ws.AutoFilter.Range.Copy
>> >> > >
>> >> > > With WSNew.Range("A1")
>> >> > > .PasteSpecial Paste:=8
>> >> > > .PasteSpecial xlPasteValues
>> >> > > .PasteSpecial xlPasteFormats
>> >> > > '
>> >> > > Application.CutCopyMode = False
>> >> > > TextBoxWorkfortoday.Text = Cells(Rows.Count, 1).End(xlUp).Row - 1
>> >> > >
>> >> > > End With
>> >> > > '
>> >> > > With ws.AutoFilter.Range
>> >> > > On Error Resume Next
>> >> > > Set rng2 = .Offset(1, 0).Resize(.Rows.Count - 1, .Columns.Count) _
>> >> > > .SpecialCells(xlCellTypeVisible)
>> >> > > On Error GoTo 0
>> >> > > If Not rng2 Is Nothing Then rng2.EntireRow.Delete
>> >> > > End With
>> >> > >
>> >> > > ws.AutoFilterMode = False
>> >> > > destWB.Close SaveChanges:=True
>> >> > > With Application
>> >> > > .ScreenUpdating = True
>> >> > > .EnableEvents = True
>> >> > > End With
>> >> > > Workbooks("Customer services test.xlsm").Worksheets("Sheet1").Activate
>> >> > > End Sub
>> >> > >
>> >> > > I have 2 questions:
>> >> > > The autofilter is not filtering on all criteria?
>> >> > > And then not deleting those records that were filtered?
>> >> > >
>> >> > > Any help?
>> >> > >
>> >> > > Thanks
>> >> > > Albert
>> >> >

>>

 
Reply With Quote
 
Albert
Guest
Posts: n/a
 
      2nd Feb 2008
Hi Ron,

I am using VB at the back of excel 2007. The datepicker I used can be found
by:
Openning the toolbox
Right clicking on it
And choosing the datepicker.

I am have problems with the value of the datepicker, so perhaps its the
wrong tool to use? Is there code I can get to pop up a month calender then
input the date and that becomes the value of the textbox and in return
populates the spreadsheet.

Thanks
Albert

"Ron de Bruin" wrote:

> Hi Albert
>
> I never work with a DTPicker1.
> But if you send me your test file private I will look at it this weekend
>
> --
>
> Regards Ron de Bruin
> http://www.rondebruin.nl/tips.htm
>
>
> "Albert" <(E-Mail Removed)> wrote in message news:230B4F3E-07CB-4FF2-B692-(E-Mail Removed)...
> >I have tried the extra lines, but still no luck.
> >
> > I have substituted your code for autofilter field=14
> >
> > It returns nothing if all filters are in place. If I block out field 14 and
> > 18 it works but not if all 3 are active
> >
> > "Ron de Bruin" wrote:
> >
> >> You need the other two filter lines also
> >>
> >> --
> >>
> >> Regards Ron de Bruin
> >> http://www.rondebruin.nl/tips.htm
> >>
> >>
> >> "Albert" <(E-Mail Removed)> wrote in message news:826A33EC-B0B6-45FE-A4D0-(E-Mail Removed)...
> >> > Hi Ron,
> >> >
> >> > It only seems to be filtering on one criteria? Have I entered the code
> >> > correctly?
> >> >
> >> > Thanks
> >> > Albert
> >> >
> >> > "Albert" wrote:
> >> >
> >> >> Hi Ron,
> >> >>
> >> >> It does not seem to work. Any other ideas. I will try during the day and let
> >> >> you know to my progress.
> >> >>
> >> >> Thanks
> >> >> Albert
> >> >>
> >> >> "Ron de Bruin" wrote:
> >> >>
> >> >> > hi Albert
> >> >> >
> >> >> > Working with = in Autofilter can give problems if you filter on one date
> >> >> >
> >> >> > Try this
> >> >> >
> >> >> > rng.AutoFilter Field:=14, Criteria1:=">=" & CLng( DTPicker1.Value), _
> >> >> > Operator:=xlAnd, Criteria2:="<=" & CLng( DTPicker1.Value)
> >> >> >
> >> >> >
> >> >> >
> >> >> > --
> >> >> >
> >> >> > Regards Ron de Bruin
> >> >> > http://www.rondebruin.nl/tips.htm
> >> >> >
> >> >> >
> >> >> > "Albert" <(E-Mail Removed)> wrote in message news:70EC317C-980E-442D-B466-(E-Mail Removed)...
> >> >> > > Hi Guys,
> >> >> > >
> >> >> > > I have been using the following code (courtesy of Ron debruin):
> >> >> > >
> >> >> > > Sub Copy_With_AutoFilter1()
> >> >> > > Dim ws As Worksheet
> >> >> > > Dim WSNew As Worksheet
> >> >> > > Dim rng As Range
> >> >> > > Dim rng2 As Range
> >> >> > > Dim rng3 As Range
> >> >> > > Dim sourceRange As Range
> >> >> > > Dim destrange As Range
> >> >> > > Dim destWB As Workbook
> >> >> > > Dim DestSh As Worksheet
> >> >> > > Dim Lr As Long
> >> >> > > Dim sourceWB As Workbook
> >> >> > >
> >> >> > > With Application
> >> >> > > .ScreenUpdating = False
> >> >> > > .EnableEvents = False
> >> >> > > End With
> >> >> > >
> >> >> > >
> >> >> > > If bIsBookOpen("Test DB.xlsm") Then
> >> >> > > Set destWB = Workbooks("Test DB.xlsm")
> >> >> > > Else
> >> >> > > Set destWB = Workbooks.Open("K:\Customer services screen\Test
> >> >> > > Database\Test DB.xlsm")
> >> >> > > End If
> >> >> > >
> >> >> > > Set ws = destWB.Sheets("Sheet1")
> >> >> > >
> >> >> > >
> >> >> > > Set rng = ws.Range("A1:ab" & Rows.Count)
> >> >> > > FieldNum = 1
> >> >> > > ws.AutoFilterMode = False
> >> >> > >
> >> >> > > On Error Resume Next
> >> >> > > Application.DisplayAlerts = False
> >> >> > > Sheets("MyFilterResult").Delete
> >> >> > > Application.DisplayAlerts = True
> >> >> > > On Error GoTo 0
> >> >> > >
> >> >> > > rng.AutoFilter Field:=3, Criteria1:="=" & ComboBoxCustomerAgent.Value
> >> >> > > rng.AutoFilter Field:=14, Criteria1:="=" & DTPicker1.Value
> >> >> > > rng.AutoFilter Field:=18, Criteria1:="= Open"
> >> >> > >
> >> >> > > Set WSNew = Workbooks("Customer services test.xlsm").Worksheets("Sheet2")
> >> >> > >
> >> >> > > ws.AutoFilter.Range.Copy
> >> >> > >
> >> >> > > With WSNew.Range("A1")
> >> >> > > .PasteSpecial Paste:=8
> >> >> > > .PasteSpecial xlPasteValues
> >> >> > > .PasteSpecial xlPasteFormats
> >> >> > > '
> >> >> > > Application.CutCopyMode = False
> >> >> > > TextBoxWorkfortoday.Text = Cells(Rows.Count, 1).End(xlUp).Row - 1
> >> >> > >
> >> >> > > End With
> >> >> > > '
> >> >> > > With ws.AutoFilter.Range
> >> >> > > On Error Resume Next
> >> >> > > Set rng2 = .Offset(1, 0).Resize(.Rows.Count - 1, .Columns.Count) _
> >> >> > > .SpecialCells(xlCellTypeVisible)
> >> >> > > On Error GoTo 0
> >> >> > > If Not rng2 Is Nothing Then rng2.EntireRow.Delete
> >> >> > > End With
> >> >> > >
> >> >> > > ws.AutoFilterMode = False
> >> >> > > destWB.Close SaveChanges:=True
> >> >> > > With Application
> >> >> > > .ScreenUpdating = True
> >> >> > > .EnableEvents = True
> >> >> > > End With
> >> >> > > Workbooks("Customer services test.xlsm").Worksheets("Sheet1").Activate
> >> >> > > End Sub
> >> >> > >
> >> >> > > I have 2 questions:
> >> >> > > The autofilter is not filtering on all criteria?
> >> >> > > And then not deleting those records that were filtered?
> >> >> > >
> >> >> > > Any help?
> >> >> > >
> >> >> > > Thanks
> >> >> > > Albert
> >> >> >
> >>

>

 
Reply With Quote
 
Ron de Bruin
Guest
Posts: n/a
 
      2nd Feb 2008
I know where it is but I always use a Calendar control

If you want I look at it for you, send me your testfile then

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Albert" <(E-Mail Removed)> wrote in message news:0DC75614-28F4-4346-862C-(E-Mail Removed)...
> Hi Ron,
>
> I am using VB at the back of excel 2007. The datepicker I used can be found
> by:
> Openning the toolbox
> Right clicking on it
> And choosing the datepicker.
>
> I am have problems with the value of the datepicker, so perhaps its the
> wrong tool to use? Is there code I can get to pop up a month calender then
> input the date and that becomes the value of the textbox and in return
> populates the spreadsheet.
>
> Thanks
> Albert
>
> "Ron de Bruin" wrote:
>
>> Hi Albert
>>
>> I never work with a DTPicker1.
>> But if you send me your test file private I will look at it this weekend
>>
>> --
>>
>> Regards Ron de Bruin
>> http://www.rondebruin.nl/tips.htm
>>
>>
>> "Albert" <(E-Mail Removed)> wrote in message news:230B4F3E-07CB-4FF2-B692-(E-Mail Removed)...
>> >I have tried the extra lines, but still no luck.
>> >
>> > I have substituted your code for autofilter field=14
>> >
>> > It returns nothing if all filters are in place. If I block out field 14 and
>> > 18 it works but not if all 3 are active
>> >
>> > "Ron de Bruin" wrote:
>> >
>> >> You need the other two filter lines also
>> >>
>> >> --
>> >>
>> >> Regards Ron de Bruin
>> >> http://www.rondebruin.nl/tips.htm
>> >>
>> >>
>> >> "Albert" <(E-Mail Removed)> wrote in message news:826A33EC-B0B6-45FE-A4D0-(E-Mail Removed)...
>> >> > Hi Ron,
>> >> >
>> >> > It only seems to be filtering on one criteria? Have I entered the code
>> >> > correctly?
>> >> >
>> >> > Thanks
>> >> > Albert
>> >> >
>> >> > "Albert" wrote:
>> >> >
>> >> >> Hi Ron,
>> >> >>
>> >> >> It does not seem to work. Any other ideas. I will try during the day and let
>> >> >> you know to my progress.
>> >> >>
>> >> >> Thanks
>> >> >> Albert
>> >> >>
>> >> >> "Ron de Bruin" wrote:
>> >> >>
>> >> >> > hi Albert
>> >> >> >
>> >> >> > Working with = in Autofilter can give problems if you filter on one date
>> >> >> >
>> >> >> > Try this
>> >> >> >
>> >> >> > rng.AutoFilter Field:=14, Criteria1:=">=" & CLng( DTPicker1.Value), _
>> >> >> > Operator:=xlAnd, Criteria2:="<=" & CLng( DTPicker1.Value)
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > --
>> >> >> >
>> >> >> > Regards Ron de Bruin
>> >> >> > http://www.rondebruin.nl/tips.htm
>> >> >> >
>> >> >> >
>> >> >> > "Albert" <(E-Mail Removed)> wrote in message news:70EC317C-980E-442D-B466-(E-Mail Removed)...
>> >> >> > > Hi Guys,
>> >> >> > >
>> >> >> > > I have been using the following code (courtesy of Ron debruin):
>> >> >> > >
>> >> >> > > Sub Copy_With_AutoFilter1()
>> >> >> > > Dim ws As Worksheet
>> >> >> > > Dim WSNew As Worksheet
>> >> >> > > Dim rng As Range
>> >> >> > > Dim rng2 As Range
>> >> >> > > Dim rng3 As Range
>> >> >> > > Dim sourceRange As Range
>> >> >> > > Dim destrange As Range
>> >> >> > > Dim destWB As Workbook
>> >> >> > > Dim DestSh As Worksheet
>> >> >> > > Dim Lr As Long
>> >> >> > > Dim sourceWB As Workbook
>> >> >> > >
>> >> >> > > With Application
>> >> >> > > .ScreenUpdating = False
>> >> >> > > .EnableEvents = False
>> >> >> > > End With
>> >> >> > >
>> >> >> > >
>> >> >> > > If bIsBookOpen("Test DB.xlsm") Then
>> >> >> > > Set destWB = Workbooks("Test DB.xlsm")
>> >> >> > > Else
>> >> >> > > Set destWB = Workbooks.Open("K:\Customer services screen\Test
>> >> >> > > Database\Test DB.xlsm")
>> >> >> > > End If
>> >> >> > >
>> >> >> > > Set ws = destWB.Sheets("Sheet1")
>> >> >> > >
>> >> >> > >
>> >> >> > > Set rng = ws.Range("A1:ab" & Rows.Count)
>> >> >> > > FieldNum = 1
>> >> >> > > ws.AutoFilterMode = False
>> >> >> > >
>> >> >> > > On Error Resume Next
>> >> >> > > Application.DisplayAlerts = False
>> >> >> > > Sheets("MyFilterResult").Delete
>> >> >> > > Application.DisplayAlerts = True
>> >> >> > > On Error GoTo 0
>> >> >> > >
>> >> >> > > rng.AutoFilter Field:=3, Criteria1:="=" & ComboBoxCustomerAgent.Value
>> >> >> > > rng.AutoFilter Field:=14, Criteria1:="=" & DTPicker1.Value
>> >> >> > > rng.AutoFilter Field:=18, Criteria1:="= Open"
>> >> >> > >
>> >> >> > > Set WSNew = Workbooks("Customer services test.xlsm").Worksheets("Sheet2")
>> >> >> > >
>> >> >> > > ws.AutoFilter.Range.Copy
>> >> >> > >
>> >> >> > > With WSNew.Range("A1")
>> >> >> > > .PasteSpecial Paste:=8
>> >> >> > > .PasteSpecial xlPasteValues
>> >> >> > > .PasteSpecial xlPasteFormats
>> >> >> > > '
>> >> >> > > Application.CutCopyMode = False
>> >> >> > > TextBoxWorkfortoday.Text = Cells(Rows.Count, 1).End(xlUp).Row - 1
>> >> >> > >
>> >> >> > > End With
>> >> >> > > '
>> >> >> > > With ws.AutoFilter.Range
>> >> >> > > On Error Resume Next
>> >> >> > > Set rng2 = .Offset(1, 0).Resize(.Rows.Count - 1, .Columns.Count) _
>> >> >> > > .SpecialCells(xlCellTypeVisible)
>> >> >> > > On Error GoTo 0
>> >> >> > > If Not rng2 Is Nothing Then rng2.EntireRow.Delete
>> >> >> > > End With
>> >> >> > >
>> >> >> > > ws.AutoFilterMode = False
>> >> >> > > destWB.Close SaveChanges:=True
>> >> >> > > With Application
>> >> >> > > .ScreenUpdating = True
>> >> >> > > .EnableEvents = True
>> >> >> > > End With
>> >> >> > > Workbooks("Customer services test.xlsm").Worksheets("Sheet1").Activate
>> >> >> > > End Sub
>> >> >> > >
>> >> >> > > I have 2 questions:
>> >> >> > > The autofilter is not filtering on all criteria?
>> >> >> > > And then not deleting those records that were filtered?
>> >> >> > >
>> >> >> > > Any help?
>> >> >> > >
>> >> >> > > Thanks
>> >> >> > > Albert
>> >> >> >
>> >>

>>

 
Reply With Quote
 
Albert
Guest
Posts: n/a
 
      2nd Feb 2008
To what address must I send it? I left your mail address at work

"Ron de Bruin" wrote:

> I know where it is but I always use a Calendar control
>
> If you want I look at it for you, send me your testfile then
>
> --
>
> Regards Ron de Bruin
> http://www.rondebruin.nl/tips.htm
>
>
> "Albert" <(E-Mail Removed)> wrote in message news:0DC75614-28F4-4346-862C-(E-Mail Removed)...
> > Hi Ron,
> >
> > I am using VB at the back of excel 2007. The datepicker I used can be found
> > by:
> > Openning the toolbox
> > Right clicking on it
> > And choosing the datepicker.
> >
> > I am have problems with the value of the datepicker, so perhaps its the
> > wrong tool to use? Is there code I can get to pop up a month calender then
> > input the date and that becomes the value of the textbox and in return
> > populates the spreadsheet.
> >
> > Thanks
> > Albert
> >
> > "Ron de Bruin" wrote:
> >
> >> Hi Albert
> >>
> >> I never work with a DTPicker1.
> >> But if you send me your test file private I will look at it this weekend
> >>
> >> --
> >>
> >> Regards Ron de Bruin
> >> http://www.rondebruin.nl/tips.htm
> >>
> >>
> >> "Albert" <(E-Mail Removed)> wrote in message news:230B4F3E-07CB-4FF2-B692-(E-Mail Removed)...
> >> >I have tried the extra lines, but still no luck.
> >> >
> >> > I have substituted your code for autofilter field=14
> >> >
> >> > It returns nothing if all filters are in place. If I block out field 14 and
> >> > 18 it works but not if all 3 are active
> >> >
> >> > "Ron de Bruin" wrote:
> >> >
> >> >> You need the other two filter lines also
> >> >>
> >> >> --
> >> >>
> >> >> Regards Ron de Bruin
> >> >> http://www.rondebruin.nl/tips.htm
> >> >>
> >> >>
> >> >> "Albert" <(E-Mail Removed)> wrote in message news:826A33EC-B0B6-45FE-A4D0-(E-Mail Removed)...
> >> >> > Hi Ron,
> >> >> >
> >> >> > It only seems to be filtering on one criteria? Have I entered the code
> >> >> > correctly?
> >> >> >
> >> >> > Thanks
> >> >> > Albert
> >> >> >
> >> >> > "Albert" wrote:
> >> >> >
> >> >> >> Hi Ron,
> >> >> >>
> >> >> >> It does not seem to work. Any other ideas. I will try during the day and let
> >> >> >> you know to my progress.
> >> >> >>
> >> >> >> Thanks
> >> >> >> Albert
> >> >> >>
> >> >> >> "Ron de Bruin" wrote:
> >> >> >>
> >> >> >> > hi Albert
> >> >> >> >
> >> >> >> > Working with = in Autofilter can give problems if you filter on one date
> >> >> >> >
> >> >> >> > Try this
> >> >> >> >
> >> >> >> > rng.AutoFilter Field:=14, Criteria1:=">=" & CLng( DTPicker1.Value), _
> >> >> >> > Operator:=xlAnd, Criteria2:="<=" & CLng( DTPicker1.Value)
> >> >> >> >
> >> >> >> >
> >> >> >> >
> >> >> >> > --
> >> >> >> >
> >> >> >> > Regards Ron de Bruin
> >> >> >> > http://www.rondebruin.nl/tips.htm
> >> >> >> >
> >> >> >> >
> >> >> >> > "Albert" <(E-Mail Removed)> wrote in message news:70EC317C-980E-442D-B466-(E-Mail Removed)...
> >> >> >> > > Hi Guys,
> >> >> >> > >
> >> >> >> > > I have been using the following code (courtesy of Ron debruin):
> >> >> >> > >
> >> >> >> > > Sub Copy_With_AutoFilter1()
> >> >> >> > > Dim ws As Worksheet
> >> >> >> > > Dim WSNew As Worksheet
> >> >> >> > > Dim rng As Range
> >> >> >> > > Dim rng2 As Range
> >> >> >> > > Dim rng3 As Range
> >> >> >> > > Dim sourceRange As Range
> >> >> >> > > Dim destrange As Range
> >> >> >> > > Dim destWB As Workbook
> >> >> >> > > Dim DestSh As Worksheet
> >> >> >> > > Dim Lr As Long
> >> >> >> > > Dim sourceWB As Workbook
> >> >> >> > >
> >> >> >> > > With Application
> >> >> >> > > .ScreenUpdating = False
> >> >> >> > > .EnableEvents = False
> >> >> >> > > End With
> >> >> >> > >
> >> >> >> > >
> >> >> >> > > If bIsBookOpen("Test DB.xlsm") Then
> >> >> >> > > Set destWB = Workbooks("Test DB.xlsm")
> >> >> >> > > Else
> >> >> >> > > Set destWB = Workbooks.Open("K:\Customer services screen\Test
> >> >> >> > > Database\Test DB.xlsm")
> >> >> >> > > End If
> >> >> >> > >
> >> >> >> > > Set ws = destWB.Sheets("Sheet1")
> >> >> >> > >
> >> >> >> > >
> >> >> >> > > Set rng = ws.Range("A1:ab" & Rows.Count)
> >> >> >> > > FieldNum = 1
> >> >> >> > > ws.AutoFilterMode = False
> >> >> >> > >
> >> >> >> > > On Error Resume Next
> >> >> >> > > Application.DisplayAlerts = False
> >> >> >> > > Sheets("MyFilterResult").Delete
> >> >> >> > > Application.DisplayAlerts = True
> >> >> >> > > On Error GoTo 0
> >> >> >> > >
> >> >> >> > > rng.AutoFilter Field:=3, Criteria1:="=" & ComboBoxCustomerAgent.Value
> >> >> >> > > rng.AutoFilter Field:=14, Criteria1:="=" & DTPicker1.Value
> >> >> >> > > rng.AutoFilter Field:=18, Criteria1:="= Open"
> >> >> >> > >
> >> >> >> > > Set WSNew = Workbooks("Customer services test.xlsm").Worksheets("Sheet2")
> >> >> >> > >
> >> >> >> > > ws.AutoFilter.Range.Copy
> >> >> >> > >
> >> >> >> > > With WSNew.Range("A1")
> >> >> >> > > .PasteSpecial Paste:=8
> >> >> >> > > .PasteSpecial xlPasteValues
> >> >> >> > > .PasteSpecial xlPasteFormats
> >> >> >> > > '
> >> >> >> > > Application.CutCopyMode = False
> >> >> >> > > TextBoxWorkfortoday.Text = Cells(Rows.Count, 1).End(xlUp).Row - 1
> >> >> >> > >
> >> >> >> > > End With
> >> >> >> > > '
> >> >> >> > > With ws.AutoFilter.Range
> >> >> >> > > On Error Resume Next
> >> >> >> > > Set rng2 = .Offset(1, 0).Resize(.Rows.Count - 1, .Columns.Count) _
> >> >> >> > > .SpecialCells(xlCellTypeVisible)
> >> >> >> > > On Error GoTo 0
> >> >> >> > > If Not rng2 Is Nothing Then rng2.EntireRow.Delete
> >> >> >> > > End With
> >> >> >> > >
> >> >> >> > > ws.AutoFilterMode = False
> >> >> >> > > destWB.Close SaveChanges:=True
> >> >> >> > > With Application
> >> >> >> > > .ScreenUpdating = True
> >> >> >> > > .EnableEvents = True
> >> >> >> > > End With
> >> >> >> > > Workbooks("Customer services test.xlsm").Worksheets("Sheet1").Activate
> >> >> >> > > End Sub
> >> >> >> > >
> >> >> >> > > I have 2 questions:
> >> >> >> > > The autofilter is not filtering on all criteria?
> >> >> >> > > And then not deleting those records that were filtered?
> >> >> >> > >
> >> >> >> > > Any help?
> >> >> >> > >
> >> >> >> > > Thanks
> >> >> >> > > Albert
> >> >> >> >
> >> >>
> >>

>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Counting Filtered Results Using Autofilter jj Microsoft Excel Worksheet Functions 2 2nd Apr 2010 12:18 AM
Is it possible to ask an autofilter what is current filtered criteriais? Chrisso Microsoft Excel Programming 1 4th Apr 2009 12:30 PM
Autofilter and count on filtered data =?Utf-8?B?Z3I4cG9zdHM=?= Microsoft Excel Worksheet Functions 7 19th Oct 2007 09:17 PM
How do i view only the filtered results from autofilter ? =?Utf-8?B?c2ltb24=?= Microsoft Excel Misc 3 16th Aug 2006 03:05 PM
Way to display filtered results from more than one autofilter per =?Utf-8?B?R1M=?= Microsoft Excel Worksheet Functions 1 5th May 2006 12:01 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:17 AM.