ashleywanless
Board Regular
- Joined
- Aug 4, 2009
- Messages
- 158
Hi,
I am trying to write a macro which takes data input into a userform and runs various autofilters based on this. A particular part of my code is triggering a Autofilter method of range class failed. The code is
The line with the * infront is the line highlighted yellow. I know the rest of the code is fine as if i replace this line with a msg box that shows fine.
RB1/2 are checkboxes on the form. WSE is a worksheet, CID1 is an integer with a current value of 7. C1 is a string with a value of =29/09/2010
OP1 is a string with a value of Or.
Can anyone think of why this error occours?
Thanks
Ashley
I am trying to write a macro which takes data input into a userform and runs various autofilters based on this. A particular part of my code is triggering a Autofilter method of range class failed. The code is
Code:
If RB1_chk.Value = True Or RB2_chk.Value = True Then
WSE.Activate
Range("A:A0").Activate
WSE.AutoFilterMode = False
Selection.AutoFilter Field:=CID1, Criteria1:=C1, Operator:=xl & OP1, Criteria2:=C2
Else
WSE.Activate
WSE.AutoFilterMode = False
*Range("A:AO").AutoFilter Field:=CID1, Criteria1:=C1
End If
The line with the * infront is the line highlighted yellow. I know the rest of the code is fine as if i replace this line with a msg box that shows fine.
RB1/2 are checkboxes on the form. WSE is a worksheet, CID1 is an integer with a current value of 7. C1 is a string with a value of =29/09/2010
OP1 is a string with a value of Or.
Can anyone think of why this error occours?
Thanks
Ashley