473,406 Members | 2,220 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

AutoFilter method of Range class failed setting criteria in VBA

Greetings-

I have AutoFilter turned on in my spreadsheet and am trying to set the criteria through VBA, but I'm continuing to get a method error. Here's the snippet of code:

Expand|Select|Wrap|Line Numbers
  1. Do While varUnit <> ""
  2.      pvtResults.PivotFields("Unit Name").CurrentPage = varUnit
  3.      shtPivot.ShowAllData
  4.      shtPivot.Range("B12:I352").AutoFilter Field:=8, Criteria1:="<>0"
  5.      intRow = intRow + 1
  6.      varUnit = shtLists.Range("U" & intRow)
  7. Loop
I even tried recording the macro and running it directly from that and I still get the same error. Any help would be appreciated.
Sep 17 '12 #1
1 4502
zmbd
5,501 Expert Mod 4TB
Place a STOP just after and DIM statements you might have in the code. When you get into the Debugger, F8 thru the code until you get the error. This way we know exactly which line is causing the exception. All too often the code that we think is failing is ok and it's the line before.
We'll also neen the error number and the description exactly as shown in the error message.
Sep 18 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Bill R via AccessMonster.com | last post by:
I get this Run-Time Error 1004 whenevery the following code runs: On Error GoTo XLSheet2 Set objXL = CreateObject("Excel.Application") With objXL Set objWkb = .Workbooks.Open(strPath) With...
0
by: Rodolfo | last post by:
Hi all.... I have to develop a class application but I must use a COM+ DLL (vb6) intalled in a remote COM+ server. The proxy application is already installed in IIS server but I can't use any...
1
by: richilli | last post by:
Hi Any help on this would be appreciated cos its driving me insane. I have a function in VB.NET that takes in an excel range and tries to delete rows where the first column starts with a...
1
by: Omar Anwar | last post by:
Hi, i m stuck again. in my update query, i want to update the time and date of the latest record entered only. For this i have to select the latest recod first. they are indexed so selecting the...
4
by: dilau | last post by:
I have a problem. The error in subject appear when i run the macro Can u tell me why Case "CENTRALIZATOR SURVEY" Dim SHT As Object Set...
0
by: denvercr | last post by:
Hi Guys, I need to embed a dropdown list in my excel automation in C#, Do you have any idea how to use Excel.Range.AutoFilter method? or any suggested sites where I can learn this thing?.. Thank...
1
by: Socko | last post by:
I'm trying to fix an sub routine in an VB module that basically reads in a MS database and writes it to an Excel Spread sheet. It works just fine except that the data isn't sorted correctly. I have...
0
by: kaushalgajjar | last post by:
Hi, I had created an active-x control (ocx) in vb6 and i have used in VB.Net and HTML using ClassId reference and the active-x was working fine with ASP.Net, HTML and VB6. Now the active-x is...
0
by: CoreyReynolds | last post by:
Hey all, I have a piece of code that dumps a bunch of data into a spreadsheet. Also rearranges it into a pivot table and then graphs the pivot table as well so my boss can get a clear view of the...
2
by: SukumarMaddineni1 | last post by:
Hi, I have one xlsm document , Using python I tried to convert that document to PDF, but COM raising pywintypes error "Save as method of Wroksheet class failed". Below is my code.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.