PC Review


Reply
Thread Tools Rate Thread

autofilter with variable criteria

 
 
=?Utf-8?B?ZHIgY2h1Y2s=?=
Guest
Posts: n/a
 
      15th Oct 2006
I have the following programming attempting to use the variable CBOX as my
Criteria1 in an autofilter. I get a syntax error on the autofilter line when
i run it. The line works fine if I use "=" as opposed to the "<>" which i
want. I am attempting to filter away the variable in CBOX.

========================
Private Sub CheckBox3_Click()
Dim cbox As String
Let cbox = CheckBox3.Caption

If CheckBox3 = False Then
Selection.AutoFilter Field:=40, Criteria1:<>cbox

Else
Selection.AutoFilter Field:=40
End If

End Sub

========================
thanks,
dr chuck
 
Reply With Quote
 
 
 
 
Tom Ogilvy
Guest
Posts: n/a
 
      15th Oct 2006
there is a difference between the <> operator and the assignment operator
for an argument. You can't do :<>


Selection.AutoFilter Field:=40, Criteria1:="<>"&cbox


--
Regards,
Tom Ogilvy




"dr chuck" <(E-Mail Removed)> wrote in message
news:95D72D49-6F99-47D6-97C0-(E-Mail Removed)...
>I have the following programming attempting to use the variable CBOX as my
> Criteria1 in an autofilter. I get a syntax error on the autofilter line
> when
> i run it. The line works fine if I use "=" as opposed to the "<>" which i
> want. I am attempting to filter away the variable in CBOX.
>
> ========================
> Private Sub CheckBox3_Click()
> Dim cbox As String
> Let cbox = CheckBox3.Caption
>
> If CheckBox3 = False Then
> Selection.AutoFilter Field:=40, Criteria1:<>cbox
>
> Else
> Selection.AutoFilter Field:=40
> End If
>
> End Sub
>
> ========================
> thanks,
> dr chuck



 
Reply With Quote
 
=?Utf-8?B?ZHIgY2h1Y2s=?=
Guest
Posts: n/a
 
      16th Oct 2006
Thanks Tom,
You always supply a wealth of information.
--
dr chuck


"Tom Ogilvy" wrote:

> there is a difference between the <> operator and the assignment operator
> for an argument. You can't do :<>
>
>
> Selection.AutoFilter Field:=40, Criteria1:="<>"&cbox
>
>
> --
> Regards,
> Tom Ogilvy
>
>
>
>
> "dr chuck" <(E-Mail Removed)> wrote in message
> news:95D72D49-6F99-47D6-97C0-(E-Mail Removed)...
> >I have the following programming attempting to use the variable CBOX as my
> > Criteria1 in an autofilter. I get a syntax error on the autofilter line
> > when
> > i run it. The line works fine if I use "=" as opposed to the "<>" which i
> > want. I am attempting to filter away the variable in CBOX.
> >
> > ========================
> > Private Sub CheckBox3_Click()
> > Dim cbox As String
> > Let cbox = CheckBox3.Caption
> >
> > If CheckBox3 = False Then
> > Selection.AutoFilter Field:=40, Criteria1:<>cbox
> >
> > Else
> > Selection.AutoFilter Field:=40
> > End If
> >
> > End Sub
> >
> > ========================
> > thanks,
> > dr chuck

>
>
>

 
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
Using a SQL statement with variable parameters and variable criteria Froefel Microsoft ASP .NET 1 4th Jul 2007 10:38 AM
autofilter criteria =?Utf-8?B?S25veA==?= Microsoft Excel Programming 3 6th Apr 2007 01:21 PM
Selection.AutoFilter Field / Criteria => criteria sometimes non-existing on worksheet markx Microsoft Excel Programming 1 24th Nov 2006 02:52 PM
AutoFilter criteria =?Utf-8?B?TWFyaw==?= Microsoft Excel Programming 1 2nd Nov 2005 12:08 PM
Variable in AutoFilter criteria morry Microsoft Excel Programming 1 30th Jun 2004 04:48 AM


Features
 

Advertising
 

Newsgroups
 


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