+ Reply to Thread
Results 1 to 10 of 10

Enter 1 of 2 values in a column conditional to another column

  1. #1
    Valued Forum Contributor
    Join Date
    04-11-2006
    MS-Off Ver
    2007
    Posts
    438

    Enter 1 of 2 values in a column conditional to another column

    Hello all,

    I would like a macro that does this

    1. Find the "Customer Number" column by name

    2. Find the range of the "Customer Number" column (bottom-most cell with data)

    3. Find the column named "Date Shipped"

    4. If there are any NON-Blank cells in the column named "Date Shipped", put the word "Sent" in the "Status" column (also needs to be found by name). This macro should stop when it is equal to the bottom-most cell in the "Customer Number" column.


    Please Login or Register  to view this content.

    Please Login or Register  to view this content.






    A couple of things I should mention..

    1. The "Customer Number" column will always have the last row of data in it, so the macro search should stop when it gets to the last row of data in the "Customer Number" column.

    2. All should be NOT be case sensitive

    3. It should work on the active worksheet

    4. I never know what column position these columns will be in, so the macro should search for column header by name.

    5. Column headers will ALWAYS be in row 1.

    Thanks much
    Last edited by duugg; 07-31-2009 at 12:02 AM. Reason: solved...again :)

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Enter 1 of 2 values in a column conditional to another column

    This should get you going:
    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Enter 1 of 2 values in a column conditional to another column

    Or this version does it without having to "loop" at the end, should be a little faster overall.
    Please Login or Register  to view this content.

  4. #4
    Valued Forum Contributor
    Join Date
    04-11-2006
    MS-Off Ver
    2007
    Posts
    438

    Re: Enter 1 of 2 values in a column conditional to another column

    Mr JBeaucaire,

    Worked awesome!

    Thanks much!

  5. #5
    Valued Forum Contributor
    Join Date
    04-11-2006
    MS-Off Ver
    2007
    Posts
    438

    Re: Enter 1 of 2 values in a column conditional to another column

    JB,

    I just had another thought for this macro that will be of great benefit.

    What code would I need to add to say "unsent" in the "Status" column if the cell in the "Date Shipped" column is blank?

    Thanks,

    duugg

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Enter 1 of 2 values in a column conditional to another column

    Please Login or Register  to view this content.

  7. #7
    Valued Forum Contributor
    Join Date
    04-11-2006
    MS-Off Ver
    2007
    Posts
    438

    Re: Enter 1 of 2 values in a column conditional to another column

    Who needs a life when code like this exists! LOL

    A BIG THANKS JB!

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Enter 1 of 2 values in a column conditional to another column

    Well, between you and me, I wouldn't do this with a macro, I'd use a worksheet formula. Something like:

    =IF(G2 > 0, "Sent", "Unsent")

  9. #9
    Valued Forum Contributor
    Join Date
    04-11-2006
    MS-Off Ver
    2007
    Posts
    438

    Re: Enter 1 of 2 values in a column conditional to another column

    Even if you don't know where the column position is? What if it changes it's position?

  10. #10
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Enter 1 of 2 values in a column conditional to another column

    When using formula, I would enter the formula as needed, then copy it down. Should take all of 30 seconds. I'm just saying....but the macro is working, so that's good, too.

+ 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