Results 1 to 13 of 13

How do I search for values and update cell totals?

Threaded View

  1. #1
    Forum Contributor
    Join Date
    01-18-2010
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    127

    How do I search for values and update cell totals?

    Hello there! This is tricky one which I really can't work out how to write code for because it's too complicated for a standard cell formula.

    Basically it's a search loop which runs the following when the file is opened. I would put it in the workbook_open sub but instead I want to have the sheet update before a main userform appears.

    What I need it to do is:

    Read each cell in column K from row 6 onwards to the last active row.

    If a value is found then store the value (let's say as variable x) and from that cell, add up each value starting in the cell that is two columns to the left (column I) and one row down, onwards going down until a cell = "" is reached in that column (contains nothing). The total values added in column I could be stored as variable y.

    Once cell = "" is reached, have x - y to make z and then the total (z)should display in the cell to the very left of the very original cell that contained the value x.

    Finally, if x = the value in the cell to the immediate left from where x is (so same row but in column J), have that whole row from column A to L turn green, else have it turn orange:


    Selection.End(x1Down).Select 
    
    Selection.Interior.ColorIndex = 4  [for Green, for example]
    Then return to searching in column K from cell where x was used onwards until the very last row.

    Can anyone help?
    Last edited by NBVC; 01-26-2010 at 08:55 AM.

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