+ Reply to Thread
Results 1 to 6 of 6

Find Value from Column B if Column N is blank or zero in same row

  1. #1
    Registered User
    Join Date
    08-30-2021
    Location
    Canada
    MS-Off Ver
    Office Pro 2019
    Posts
    7

    Find Value from Column B if Column N is blank or zero in same row

    Good afternoon,

    I am looking for a few lines of code that takes the values from Column B if the value in Column N is either Blank or zero

    Please Login or Register  to view this content.
    Example: Cell N15 is blank, the Value in cell B15 is "Store 123" I need "Store 123" to be stored in LocationID. It is possible that there could be no cells or multiple cells that will be zero/blank. Only the first one needs to be captured. Since the code can be run manually, the user can press the button multiple times to find additional zero/blank fields.

    Thank you,

    K.
    Last edited by alansidman; 09-20-2021 at 11:18 PM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,888

    Re: Find Value from Column B if Column N is blank or zero in same row

    Code Tags Added
    Your post does not comply with Rule 2 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found at http://www.excelforum.com/forum-rule...rum-rules.html



    (I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    08-30-2021
    Location
    Canada
    MS-Off Ver
    Office Pro 2019
    Posts
    7

    Re: Find Value from Column B if Column N is blank or zero in same row

    works and understood - thank you.

  4. #4
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: Find Value from Column B if Column N is blank or zero in same row

    It is possible that there could be no cells or multiple cells that will be zero/blank.
    Only the first one needs to be captured
    So what happens if their are none...
    What happens if there are multiple...Only the first one needs to be captured...
    Since the code can be run manually, the user can press the button multiple times to find additional zero/blank fields.
    If you run code that doesn't edit the first one found then that one is always going to be first...one found

    So perhaps upload a sample file and explain in detail what must happen each time this supposed code is run...

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Last edited by sintek; 09-21-2021 at 06:37 AM.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  5. #5
    Registered User
    Join Date
    08-30-2021
    Location
    Canada
    MS-Off Ver
    Office Pro 2019
    Posts
    7

    Re: Find Value from Column B if Column N is blank or zero in same row

    Good afternoon,

    I replied earlier but I see that my reply was not posted/saved. Sometimes, when I post my complete desired result, the contributor provides the complete code. For the contributor it's 10 minutes on a keyboard, for me it's 10 seconds to cut/paste and move on without understanding/appreciating what is happening in the code. In your comments you pointed out something that I did not think of - exit my For/If loop or the sub. So I came up with the following:

    Please Login or Register  to view this content.
    My subs will do the following:
    Search the Template tab for zero or blank cells in Column N (between two rows) - complete
    Find the Location ID (on the row where the blank/zero values is in Column N) - complete with your line of code

    Last, I will be going through each visible tab and deleting any rows where the LocationID appears. For that I will be passing the variable LocationID to another sub that will loop through visible sheets and delete any rows where LocationID is present. Currently, I was using an input box to capture user input, but that can be prone to user error. So I am in the process of automating this.

    Thank you,

  6. #6
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: Find Value from Column B if Column N is blank or zero in same row

    I am very certain that these two processes can be combined ... or ... just simplified with one snippet of code...Can only say once you upload a sample file depicting your actual setup and explain the process in more detail...

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 6
    Last Post: 03-01-2018, 12:16 PM
  2. [SOLVED] Formula Index Column to find first blank cell and sum cells in different Column
    By Hood in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 12-18-2017, 07:57 PM
  3. Replies: 8
    Last Post: 09-16-2014, 09:49 AM
  4. find last blank row from column 'c' paste data from that row in column a
    By 13lack13lade in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-08-2013, 07:18 PM
  5. [SOLVED] Find column number of the furthest non-blank column
    By SPOPKY in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-25-2013, 11:50 AM
  6. [SOLVED] VBA Find last row and column that contain data and delete all blank rows and blank columns
    By bcn1988 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-03-2012, 01:07 PM
  7. macro to find first blank cell in a column cut the value from left adjacent column
    By willykin in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-01-2012, 09:23 AM

Tags for this Thread

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