+ Reply to Thread
Results 1 to 6 of 6

Checking Data in a column

Hybrid View

  1. #1
    Registered User
    Join Date
    11-09-2009
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    3

    Checking Data in a column

    Hey Folks - looking for some direction here, and I am hoping someone can help!

    I am trying to design a script which will:

    Check a an excel table (one column) to see if the check variable is set to "N" (as opposed to "Y"), and return the values from the first row it finds with a "N".

    Now I have it checking the first line (Cell B1), but I am uncertain how to make it loop all the way through the 400 lines of the sheet to check each row.

    What I am essentially doing is having a script pull a number from a table, and once that number is pulled, setting the check variable to "Y" (used).

    So that the next person to run the script will get the next set of data associated with the first available "N" (not used).

    I assume I can use a "For" script, and create something like a:

    Dim i , x, k  as variant
    
    For i = 2 To 400
    
    If x = "N" Then
         k = ??.value
    
    End if
    
    Next i

    But I am uncertain how to code this properly.

    thanks in advance for your help!!

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Checking Data in a column

    Quicker to use Find, but not sure exactly what you're doing.
    return the values from the first row it finds with a "N".
    Where are these values? I suggest you attach a small sample workbook.

  3. #3
    Registered User
    Join Date
    11-09-2009
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Checking Data in a column

    The Structure would be something like:

    ________A ____________ B ____________ C________________

    1_______ Y _______ CTR0001 _______ COMPANY 1________________
    2_______ Y _______ CTR0002 _______ COMPANY 2________________
    3_______ N _______ CTR0003 _______ COMPANY 3________________
    4 _______ N _______ CTR0004 _______ COMPANY 4________________



    My script currently checks the first row only. I want it to keep checking the row until it finds the variable "N" (in this case A3).

    Once it does, I want it to return the values found in the corresponding cells B3 and C3 in this case.

  4. #4
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Checking Data in a column

    OK, I understand, but please post a sample workbook.

  5. #5
    Registered User
    Join Date
    11-09-2009
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Checking Data in a column

    Thanks Stephen, unfortunately I haven't received any data yet for the workbook, so all I have in my .xls document is that exact data! (just my own entries to play around with).

    I would if I could - and if you'd like me to post it with those 4 lines, I will!

  6. #6
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Checking Data in a column

    A mock-up is fine, but make sure it's large enough to reflect your likely actual dataset. If 4 lines is enough, so be it.

+ 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