+ Reply to Thread
Results 1 to 4 of 4

If cell contains "No", adjacent cells auto-populate "NA"

  1. #1
    Registered User
    Join Date
    06-28-2016
    Location
    Singapore
    MS-Off Ver
    2010
    Posts
    6

    If cell contains "No", adjacent cells auto-populate "NA"

    Hi all, I'm very new to VBA and would need your assistance on this which I've been trying to get it work but to no avail. I currently have a private sub for worksheet_change in my existing worksheet, and would now like to add a new criteria.

    Currently, if "Any Funding?" column changes, both "Funding Approved?" and "Source of Funding" will be cleared of their contents. This is done with worksheet_change. Now, in the same "Any Funding" column, if selection is "No", I would like to set "Funding Approved?" and "Source of Funding" to "NA". Is this possible?


    Current VBA is:

    Private Sub Worksheet_Change(ByVal Target As Range)

    If Not Intersect(Target, Range("A2:A10")) Is Nothing Then
    Target.Offset(0, 1).ClearContents
    Target.Offset(0, 2).ClearContents
    End If

    End Sub

    I've also attached a sample workbook for reference.
    Thanks very much for anyone's help! Appreciate it!
    Attached Files Attached Files
    Last edited by chaijing; 07-05-2016 at 04:38 AM.

  2. #2
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: If cell contains "No", adjacent cells auto-populate "NA"

    Please Login or Register  to view this content.
    In the future posts, please remember to put VBA codes in
    Please Login or Register  to view this content.
    [/NOPARSE] tags. For now, please edit your original post to include them, thanks!
    多么想要告诉你 我好喜欢你

  3. #3
    Registered User
    Join Date
    06-28-2016
    Location
    Singapore
    MS-Off Ver
    2010
    Posts
    6

    Re: If cell contains "No", adjacent cells auto-populate "NA"

    thanks a million millz! works perfectly now! will google up on target.countlarge to understand further. Cheers!

  4. #4
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: If cell contains "No", adjacent cells auto-populate "NA"

    CountLarge basically is just used to count the number of cells (in this scenario) in the Target variable. Meaning, the code will only work if you change 1 cell at a time. If you attempt to paste a list/multiple rows of values into column A, it will not work. If you want it to work for pasting a list of "No" it will require a different approach.

+ 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: 9
    Last Post: 03-05-2016, 12:53 AM
  2. [SOLVED] if formula needed to populate either "1" or "0" based on number of units in another cell
    By excelteam777 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-07-2015, 11:24 AM
  3. [SOLVED] Auto-populate "Yes" "No" based on multiple criteria.
    By jtmoore in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-18-2014, 09:12 AM
  4. Replies: 4
    Last Post: 11-17-2013, 12:05 PM
  5. [SOLVED] How to USE """"" cells count """"" change font color
    By austin123456 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-09-2013, 06:14 AM
  6. [SOLVED] Adjacent cells - setting criteria for "A" while averaging "B"
    By ilovemonkeys in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-09-2013, 11:57 AM
  7. [SOLVED] Data validation: allow entry into a cell if other three cells have "X", "Y" and "Z"?
    By RogerRangeRover in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-05-2013, 04:49 AM

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