+ Reply to Thread
Results 1 to 8 of 8

Code working when using F8, but doesnt work properly through button click.

  1. #1
    Forum Contributor
    Join Date
    05-20-2013
    Location
    Ann Arbor, MI
    MS-Off Ver
    Excel 2010
    Posts
    255

    Code working when using F8, but doesnt work properly through button click.

    Okay, so I have a code that works perfectly when I go into Vb and run it manually.

    I have this code linked to a button, and the button click sub calls these two subs which are in separate modules.

    When I click the button on the worksheet, it does not result in the same thing.

    I have attached my workbook. The button I am using is located on "ClaimsKL" and it is called "Modify data" (ModifyBTN)


    When running the code through F8, it is supposed to delete all rows that contain "#N/A or """ in the F column, and it does this perfectly. BUT, when I press the modify button, it does not delete these rows, it simply removes the "#N/A" and replaces it with "".

    Please Help!
    Attached Files Attached Files

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Code working when using F8, but doesnt work properly through button click.

    in your Final routine replace
    Please Login or Register  to view this content.
    by
    Please Login or Register  to view this content.
    (note the periods before Cells)
    and in future I suggest you don't simply put on error resume next in your code for no reason ;-)
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  3. #3
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Code working when using F8, but doesnt work properly through button click.

    What do you expect to be the last line in your data, The First code line below (Part of you Code), Returns 224 where the next line returns 297 , which is actually the last line in the sheet.
    Which is correct ???
    Could this be a problem ???
    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    05-20-2013
    Location
    Ann Arbor, MI
    MS-Off Ver
    Excel 2010
    Posts
    255

    Re: Code working when using F8, but doesnt work properly through button click.

    thanks joseph!

    should I get rid of the "On error resume next?"

  5. #5
    Forum Contributor
    Join Date
    05-20-2013
    Location
    Ann Arbor, MI
    MS-Off Ver
    Excel 2010
    Posts
    255

    Re: Code working when using F8, but doesnt work properly through button click.

    MickG,

    it should be returning 224 if it is working correctly.
    If it is returning 297, it has not deleted the rows that it needs to delete

  6. #6
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Code working when using F8, but doesnt work properly through button click.

    no-but you should be careful about where you place it (to be fair you need it here in case there are no blank cells) and cancel it as soon as possible

  7. #7
    Forum Contributor
    Join Date
    05-20-2013
    Location
    Ann Arbor, MI
    MS-Off Ver
    Excel 2010
    Posts
    255

    Re: Code working when using F8, but doesnt work properly through button click.

    Thanks so much!
    I can always count on you!!

  8. #8
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Code working when using F8, but doesnt work properly through button click.

    Sorry I see it was another (Not the active) sheet it referred to. !!!!

+ 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] Work Order tracker date code not working properly
    By Jeff up North in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-15-2013, 03:25 PM
  2. Double Click not working properly
    By MCertik in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-23-2012, 02:32 PM
  3. selecting an offsett cell - doesnt work properly..
    By impartrudie in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-10-2011, 05:19 AM
  4. Why doesnt this line of code work???
    By joseclar in forum Excel General
    Replies: 1
    Last Post: 05-05-2009, 02:01 PM
  5. The menu bar is not visible & right click doesnt work
    By Rohit Jain in forum Excel General
    Replies: 1
    Last Post: 04-07-2006, 02:50 AM

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