+ Reply to Thread
Results 1 to 3 of 3

Look at last 7 rows in worksheets, put results to sheet 1

  1. #1
    Registered User
    Join Date
    05-29-2008
    Posts
    5

    Look at last 7 rows in worksheets, put results to sheet 1

    I have a macro that will output a negative value if something is wrong with a certain row. What I want to do now is make a macro that will scan sheet 2 thru the end for the last 7 rows with data, and count negative values. If 4 of the 7 have negative values, it goes into Sheet 1 and puts an x next to the sheet name.

    Logic:
    hit button on sheet 1 -> go to Sheet 2 - count negative values in last 7 rows on column K (11) -> if more than 4, go to first sheet to the sheet name (column J) -> go right 2 -> put an X -> go to sheet 3

    I tried my hand at writing some of the code, but I'm still very new at excel...

    'loop thru all the worksheets, selecting the last 7 values in column J and defining that as a range. in the code below, I try to do stuff with the range but I get very lost there.
    Please Login or Register  to view this content.
    'not sure how to implement this part about writing to the first sheet
    Please Login or Register  to view this content.
    Thanks, I'm really terrible at code...

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Look at last 7 rows in worksheets, put results to sheet 1

    xmmx,

    Give this a try:
    Please Login or Register  to view this content.


    Notes:
    -If, in column J of sheet1, the worksheet name is not found, the macro will return an error.

    Hope that helps,
    ~tigeravatar

  3. #3
    Registered User
    Join Date
    05-29-2008
    Posts
    5

    Re: Look at last 7 rows in worksheets, put results to sheet 1

    Thanks so much, this works exactly like I imagined!

+ 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