+ Reply to Thread
Results 1 to 13 of 13

VBA code only works when i entered values manually

  1. #1
    Forum Contributor keshavtale's Avatar
    Join Date
    03-13-2013
    Location
    india
    MS-Off Ver
    excel 2019
    Posts
    597

    VBA code only works when i entered values manually

    In the attached file there is VBA code , use of this code is find specific sum of values and highlight that values, you can see in that file cell A2, A3, A4 is highlighted
    because sum of that values is 433159 get matched which i entered in VBA code, but problem is now i use msoffice 2016 i do not know that is the reason behind it or any other reason , now this code only works when i entered values manually in A column, and whein i copy paset values then code not work
    please give me solution of that problem
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    31,252

    Re: VBA code only works when i entered values manually

    Copy/paste has no impact on the macro BUT the macro only matches TOTAL in range 433158 To 433160. so if no matching total is found, it (should but does not!) return a blank (or "error")
    Last edited by JohnTopley; 03-26-2024 at 06:02 AM.
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  3. #3
    Forum Contributor keshavtale's Avatar
    Join Date
    03-13-2013
    Location
    india
    MS-Off Ver
    excel 2019
    Posts
    597

    Re: VBA code only works when i entered values manually

    do you try decimal values put this value in cell A3 224853.53 then try to run code successfully

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    31,252

    Re: VBA code only works when i entered values manually

    It will NEVER match on any total where the data is not whole numbers. Your intial post is completely mis-leading as the issue has nothing to do with copy/paste!

  5. #5
    Forum Contributor keshavtale's Avatar
    Join Date
    03-13-2013
    Location
    india
    MS-Off Ver
    excel 2019
    Posts
    597

    Re: VBA code only works when i entered values manually

    you mean i will post new thread for this new problem , when you say that code is running successfully on your side then i thought by this angle then i just found this problem ,
    because whein i entering values i entered whole values i do not know there is decimal value because it is hidden and when i copy paset values it also copies decimal values , so please give me solution for this problem
    Last edited by keshavtale; 03-26-2024 at 06:34 AM.

  6. #6
    Forum Contributor keshavtale's Avatar
    Join Date
    03-13-2013
    Location
    india
    MS-Off Ver
    excel 2019
    Posts
    597

    Re: VBA code only works when i entered values manually

    and this my second reply and also take care of my previous reply , the VBA code not work with decimal values and also when i copy paste values it is not work believe me you take access of my computer through anydesk through remote session then you can see the problem , i attached another file where i copy and pasted values please check that in this file VBA code works on your computer
    Attached Files Attached Files
    Last edited by keshavtale; 03-26-2024 at 07:03 AM.

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    31,252

    Re: VBA code only works when i entered values manually

    As per my previous replies, if I cut, then paste, no problem: nor with data being decimal, OTHER than it has to a whole number i.e no digits after the decimal point.

    And macro only matches TOTAL in range 433158 to 433160 i.e integer values.

  8. #8
    Forum Contributor keshavtale's Avatar
    Join Date
    03-13-2013
    Location
    india
    MS-Off Ver
    excel 2019
    Posts
    597

    Re: VBA code only works when i entered values manually

    you are right when i cut and paste values then VBA code work, it is possible when i pick values from formula it means when i paste only values from formula so i think that is the cause VBA code not work if i am right then what is the solution for that

  9. #9
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    31,252

    Re: VBA code only works when i entered values manually

    If you delete entry from C2 and then macro, what result do you get?

    Please Login or Register  to view this content.
    Clears C2 and is blank after running macro if no match found

  10. #10
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    31,252

    Re: VBA code only works when i entered values manually

    Post a file with an EXACT replication of what you are doing.

  11. #11
    Forum Contributor keshavtale's Avatar
    Join Date
    03-13-2013
    Location
    india
    MS-Off Ver
    excel 2019
    Posts
    597

    Re: VBA code only works when i entered values manually

    i attached file where i copying values from that file you should copy only yellow color values
    Attached Files Attached Files

  12. #12
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    31,252

    Re: VBA code only works when i entered values manually

    The reason they do NOT match is : 224853.0 is actually 224852.9641! Obviously you were manually entering 224853.0 - hence it worked

    Try

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    in the source sheet
    Attached Files Attached Files
    Last edited by JohnTopley; 03-26-2024 at 09:51 AM.

  13. #13
    Forum Contributor keshavtale's Avatar
    Join Date
    03-13-2013
    Location
    india
    MS-Off Ver
    excel 2019
    Posts
    597

    Re: VBA code only works when i entered values manually

    Thanks now my problem is solved

+ 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] Paste Visible Cells Only - works only if step through code manually
    By dflak in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-10-2019, 10:36 AM
  2. Replies: 1
    Last Post: 03-31-2015, 03:01 PM
  3. Code works when cell is manually changed only the first time and not with vba
    By sdl2 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-17-2014, 08:18 PM
  4. Forecast() of manually entered values instead of a selected range
    By a3307127 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-19-2014, 04:41 AM
  5. Replies: 2
    Last Post: 05-04-2010, 06:19 AM
  6. [SOLVED] VLOOKUP only works on data manually entered.
    By Mike Rogers in forum Excel General
    Replies: 6
    Last Post: 04-25-2006, 02:20 PM
  7. #N/A Values : Returned by Formulas vs Entered Manually
    By monir in forum Excel Charting & Pivots
    Replies: 8
    Last Post: 07-06-2005, 09:05 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