+ Reply to Thread
Results 1 to 14 of 14

macro filter excel 2003

  1. #1
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    macro filter excel 2003

    Hello everyone.
    I have created here at home with excel 2007 these macros that filter a column B. Here at home do not give problem.
    In my office with Excel 2003 does not work with.
    In the settings of Excel 2003 worksheet protection > flag = automatic filters but then this setting disappears in excel 2003.
    A help?
    I hope I explained
    max_max

    FILTRA_2003.xls

  2. #2
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: macro filter excel 2003

    Hi max_max,

    If I understand correctly, you want to be able to use AutoFilter both manually and from the CommandButtons.

    Try changing the Macros to (changes in red):
    Please Login or Register  to view this content.
    The above code worked for me in both Excel 2003 and 32 bit Excel 2010. To get non-blanks when accessing manually in Excel 2010, I had to Select All, then Unselect Blanks.

    If you need different protection, try using the Macro Recorder as a guide.

    Lewis

    P.S. I should be finished with an answer to your other thread today or tomorrow.

  3. #3
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    Re: macro filter excel 2003

    Hello Lewis.
    Thanks I try new macro morning in the office.
    Meanwhile, I thank you again.
    max_max

  4. #4
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    Re: macro filter excel 2003

    Hello Lewis,
    I tried your edit and work.
    Thanks again.
    Greetings from Italy.
    max_max

  5. #5
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    Re: macro filter excel 2003

    Hello
    I added a warning at the beginning of the macro:
    if there is nothing to filter the macro stops and exits
    but if there is something in the range of the macro filters the range
    but does not turn, it gives runtime error 13 type mismatch.
    The macro:

    Please Login or Register  to view this content.
    A help?
    Thank you in advance.
    max_max
    Last edited by max_max; 12-17-2015 at 03:53 PM.

  6. #6
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: macro filter excel 2003

    Hi,

    You can't test whether a range is empty using the following code:
    Please Login or Register  to view this content.
    There is probably a better way, but I read each cell (trim() removes leading and trailing spaces). If the length of the string after trim() is ZERO, then I consider the cell to be EMPTY.


    Try this:
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    Re: macro filter excel 2003

    Hello lewis,
    Thank you for the quick reply.
    In the notice (avviso) must be only one button to exit the macro.
    max_max

  8. #8
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: macro filter excel 2003

    Try:
    Please Login or Register  to view this content.

  9. #9
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    Re: macro filter excel 2003

    After "ok" filter opens.
    max_max

    FILTRA_2003_new.xls

  10. #10
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: macro filter excel 2003

    Sorry,

    Please Login or Register  to view this content.

  11. #11
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    Re: macro filter excel 2003

    Thank you Lewis,
    now it's OK.!
    A greeting.
    max_max

  12. #12
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    Re: macro filter excel 2003

    Hello,
    because I like to try other solutions I'm trying this macro with If - Elseif
    but no works. Is the wrong solution or I am wrong?
    A help?
    The macro:

    Please Login or Register  to view this content.
    Thanks in advance.
    max_max

  13. #13
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: macro filter excel 2003

    Hi,

    The easiest way to debug is to have a lot of intermediate values.

    Debugger Secrets:
    a. Press 'F8' to single step (goes into subroutines and functions).
    b. Press SHIFT 'F8' to single step OVER subroutines and functions.
    c. Press CTRL 'F8' to stop at the line where the cursor is.
    d. 'Left Click' the margin to the left of a line to set (or clear) a BREAKPOINT.
    e. Press CTRL 'G' to open the IMMEDIATE WINDOW. 'debug.print' statements send their
    output to the IMMEDIATE WINDOW.
    f. Select View > Locals to see all variables while debugging.
    g. To automatically set a BREAKPOINT at a certain location put in the line:
    'Debug.Assert False'
    h. To conditionally set a BREAKPOINT at a certain location put in lines similar to:
    if i >= 20 and xTV20 > 99.56 then
    Debug.Assert False
    endif
    i. A variable value will be displayed by putting the cursor over the variable name.

    To manually set a breakpoint, see http://www.wiseowl.co.uk/blog/s196/breakpoints.htm

    -----------------------
    Good try, but you are trying to make things too complicated. You don't need both IsEmpty and CountA.
    a. CountA returns the number of non-empty cells.
    b. CountA("B2:B20") should be CountA(Range("B2:B20"))
    c. Because the Odd numbered cells contain formulas, CountA will NEVER be ZERO. It does not look like CountA can be used.


    SpecialCells is something that can be used, but requires a lot of code:
    Please Login or Register  to view this content.
    For more information about 'SpecialCells' see https://msdn.microsoft.com/en-us/lib.../ff196157.aspx

    I hope this helps.

  14. #14
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    Re: macro filter excel 2003

    Hello Lewis,
    is becoming too complicated, my knowledge of VBA is simple.
    I thank you for your work, but for me it's too complicated.
    A greeting.
    max_max

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Update Access 2003 records using Excel 2003 via macro
    By kennethqiu in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-04-2014, 05:58 PM
  2. Advanced Filter - Excel 2003
    By STANSBURY in forum Excel General
    Replies: 10
    Last Post: 10-16-2012, 10:20 AM
  3. Macro multiple filter for excel 2003
    By Abhijit2011 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-02-2012, 01:45 PM
  4. Filter several pivot tables by one programmed date range filter in Excel 2003
    By olewka in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-08-2011, 11:49 AM
  5. [SOLVED] Filter by upper case - MS Excel 2003
    By Little Master in forum Excel General
    Replies: 2
    Last Post: 05-19-2009, 06:46 AM
  6. [SOLVED] Excel 2003 doesn't filter correctly
    By tclarke012 in forum Excel General
    Replies: 2
    Last Post: 08-07-2005, 08:05 AM
  7. [SOLVED] need pcx graphics filter for excel 2003
    By The Jezereck in forum Excel General
    Replies: 0
    Last Post: 05-03-2005, 02:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1