+ Reply to Thread
Results 1 to 7 of 7

Thread: Auto-Delete Cell Value After Selection from List

  1. #1
    Registered User
    Join Date
    04-18-2009
    Location
    san diego, california
    MS-Off Ver
    Excel 2007
    Posts
    6

    Auto-Delete Cell Value After Selection from List

    So what i'm looking for is that I have two lists via Data Validation, and when someone changes their selection in list A, i'd like for list B to auto-delete whatever value it had in it.


    Also, on a different topic, i'd like to know how to hide certain sheets in a workbook from public view.
    Last edited by orcheon; 04-26-2009 at 03:03 PM.

  2. #2
    Forum Guru JBeaucaire's Avatar
    Join Date
    03-21-2008
    Location
    Bakersfield, CA
    MS-Off Ver
    2010
    Posts
    19,223

    Re: Auto-Delete Cell Value After Selection from List

    You most likely need a worksheet_change macro watching the primary cell(s) and deleting the selections in the secondary cell(s) when a change is made.
    Private Sub Worksheet_Change(ByVal Target As Range)
    
        If Not Intersect(Target, Range("H1")) Is Nothing Then
            Range("I1:J1").ClearContents
        End If
    
    End Sub
    Right-click on the sheet tab and select VIEW CODE...paste in the code above and adjust the cell references.
    _________________
    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
    Registered User
    Join Date
    04-18-2009
    Location
    san diego, california
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Auto-Delete Cell Value After Selection from List

    That works great, thanks!


    If i'm saving my workbook and putting it on googledocs or a different site, how can I hide worksheets from public view while still using them in the sheet I want to display?

    Is there a way to do this without macros? Can't upload it to googledocs if I have to save it in .xlsm format =/
    Last edited by orcheon; 04-25-2009 at 03:46 PM.

  4. #4
    Forum Guru JBeaucaire's Avatar
    Join Date
    03-21-2008
    Location
    Bakersfield, CA
    MS-Off Ver
    2010
    Posts
    19,223

    Re: Auto-Delete Cell Value After Selection from List

    Not the best place for GoogleDocs questions...but maybe you'll get lucky. Someone around here may use it.

    Meanwhile, if that takes care of your Excel need, be sure to EDIT your original post (Go Advanced) and mark the PREFIX box [SOLVED]
    _________________
    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!)

  5. #5
    Registered User
    Join Date
    10-07-2010
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    3

    Question Re: Auto-Delete Cell Value After Selection from List

    Quote Originally Posted by JBeaucaire View Post
    You most likely need a worksheet_change macro watching the primary cell(s) and deleting the selections in the secondary cell(s) when a change is made.
    Private Sub Worksheet_Change(ByVal Target As Range)
    
        If Not Intersect(Target, Range("H1")) Is Nothing Then
            Range("I1:J1").ClearContents
        End If
    
    End Sub
    Right-click on the sheet tab and select VIEW CODE...paste in the code above and adjust the cell references.

    sir

    for me above given code works with only given cell reference please let me know what was the code for whole coulmn

    I try following code

    Private Sub Worksheet_Change(ByVal Target As Range)
    
        If Not Intersect(Target, Range("H1:H10")) Is Nothing Then
            Range("I8:J10").ClearContents
        End If
    
    End Sub
    but it delite all coulmn data in coumn I & J when i delet or Put any cell value in column H

  6. #6
    Forum Guru JBeaucaire's Avatar
    Join Date
    03-21-2008
    Location
    Bakersfield, CA
    MS-Off Ver
    2010
    Posts
    19,223

    Re: Auto-Delete Cell Value After Selection from List

    Give an example of a change in cell H1 should cause which cells to clear? A change in H2 should cause which cells to clear?
    _________________
    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!)

  7. #7
    Registered User
    Join Date
    10-07-2010
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Auto-Delete Cell Value After Selection from List

    Quote Originally Posted by JBeaucaire View Post
    Give an example of a change in cell H1 should cause which cells to clear? A change in H2 should cause which cells to clear?
    i create the Bill of material sheet using multiple column dependent data validation (drop down list)

    refer the attachment

    My selection is

    when i select cell Value in Column B drop down list then cell Value in Column C drop down list show only range/List related with column B cell value.

    My problem is

    When I change or delete the Column B cell value then Column C value is as per last selection value until i Chang or delete it


    I want solution for
    when i change or delete the column B cell value then Column C cell value must be blank until i select it from drop down list.
    Attached Files Attached Files

+ 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.2.0