Help to modify code not giving same result when run from a different sheet

  • HI!


    I have an excel sheet which copies data from tab "X_Reports" to tab "Summary". When i am in Summary sheet and i trigger the below code, the result in Count column is giving me the correct values. However, when i am in different sheet, lets say "Daily Recon" it gives a result in Summary sheet in column Count is Zero

    Kindly help me to modify the code to give a correct value even if i trigger from any other sheet.

    below is the code

  • Hi,


    Have you tried to insert at the top of your macro :

    Code
    1. wsMain.Activate

    Hope this will help

    :)

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Thumbs Up" icon, below, in the bottom right corner:)

  • To be on the safe side .... below is the modified macro


    Hope this will help

    :)

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Thumbs Up" icon, below, in the bottom right corner:)

  • Glad you could fix your problem :)


    Thanks for your Thanks ...AND for the Like :thumbup:

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Thumbs Up" icon, below, in the bottom right corner:)

  • And you should never just stick On Error Resume Next at the top of your main routine and hope for the best! If anything does go wrong, you won't be alerted to it.

    Rory
    Theory is when you know something, but it doesn’t work. Practice is when something works, but you don’t know why. Programmers combine theory and practice: nothing works and they don’t know why