+ Reply to Thread
Results 1 to 5 of 5

VBA code for reference cells data check

  1. #1
    Registered User
    Join Date
    10-04-2012
    Location
    SF, US
    MS-Off Ver
    Excel 2007
    Posts
    2

    VBA code for reference cells data check

    Can anyone help with creating a VBA code that sums up in a the data referenced from an index list, and if the summation matches the value of another/different cell then the cell turns green otherwise red.

    For example, Sheet2 cell B1= "=Sheet1!A1" and Sheet2 cell B2="=Sheet1!A5". The sum value is in cell A10 but it typed in as a number, not as a reference.
    The reason why I want to reference Sheet1 cells is because I may add or subtract lines from Sheet1 but don't want my calculations to change.

    In VBA I want to check whether the value of Sheet2 (B1 + B2) which reference Sheet1 cells A1 and A2 equal the value in A10.
    If this is true, cell A10 turns green, else red.

    Could this code span for example cells A1...E1, A5...E5, and A10...E10?

    Thank you,
    John

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: VBA code for reference cells data check

    Does this help?

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    10-04-2012
    Location
    SF, US
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: VBA code for reference cells data check

    Thank you this has been pretty useful!

  4. #4
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,361

    Re: VBA code for reference cells data check

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as "SOLVED".
    For the meantime I'll do it for you.

    How?
    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

    Note:
    You can also thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given.
    By doing so you can add to the reputation(s) of those who helped and shared their time in helping you.
    I think people forget the word "THANK YOU!!!!" Do you still know it???

    There is a little star ( ADD REPUTATION ) below those person who helped you. Click it to say your "PRIVATE APPRECIATION TO THEIR EFFORT ON THEIR CONTRIBUTIONS "

    Regards,
    Vladimir

  5. #5
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: VBA code for reference cells data check

    Quote Originally Posted by JohnSavag View Post
    Thank you this has been pretty useful!
    You are welcome. Glad too help out, and thanks for the feedback. Please comply with Post #4.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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