+ Reply to Thread
Results 1 to 4 of 4

Clear Contents Help

  1. #1
    michael
    Guest

    Clear Contents Help

    I'd like some help with clearing contents using vba.

    If cell D18="Combo" (selected from a Data Validation List), clear the
    contents of cells D19, D20, D21, D22 & D26.

    If cell D18="One" (selected from a Data Validation List), clear the
    contents of cells D23, D24, D26, D27, D28 & D29.

    Much thanks in advance!

    -Mike


  2. #2
    Ron de Bruin
    Guest

    Re: Clear Contents Help

    You can use the change event to do this

    Place the code in the Sheet module

    Right click on a sheet tab and choose view code
    Paste the code there
    Alt-Q to go back to Excel

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Application.Intersect(Range("D18"), Target) Is Nothing Then
    If Target.Value = "Combo" Then Range("D19, D20, D21, D22:D26").ClearContents
    If Target.Value = "One" Then Range("D23, D24, D26, D27, D28:D29").ClearContents
    End If
    End Sub


    --
    Regards Ron De Bruin
    http://www.rondebruin.nl



    "michael" <[email protected]> wrote in message news:[email protected]...
    > I'd like some help with clearing contents using vba.
    >
    > If cell D18="Combo" (selected from a Data Validation List), clear the
    > contents of cells D19, D20, D21, D22 & D26.
    >
    > If cell D18="One" (selected from a Data Validation List), clear the
    > contents of cells D23, D24, D26, D27, D28 & D29.
    >
    > Much thanks in advance!
    >
    > -Mike
    >




  3. #3
    Die_Another_Day
    Guest

    Re: Clear Contents Help

    Sub ClearData
    If Range("D18").Value = "Combo" then
    Range("D19:D22").ClearContents
    Range("D26").ClearContents
    elseif Range("D18").value = "One" then
    Range("D23:D24").ClearContents
    Range("D26:D29").ClearContents
    end if
    End Sub

    HTH

    Die_Another_Day

    michael wrote:
    > I'd like some help with clearing contents using vba.
    >
    > If cell D18="Combo" (selected from a Data Validation List), clear the
    > contents of cells D19, D20, D21, D22 & D26.
    >
    > If cell D18="One" (selected from a Data Validation List), clear the
    > contents of cells D23, D24, D26, D27, D28 & D29.
    >
    > Much thanks in advance!
    >
    > -Mike



  4. #4
    michael
    Guest

    Re: Clear Contents Help

    Thank you!

    michael wrote:
    > I'd like some help with clearing contents using vba.
    >
    > If cell D18="Combo" (selected from a Data Validation List), clear the
    > contents of cells D19, D20, D21, D22 & D26.
    >
    > If cell D18="One" (selected from a Data Validation List), clear the
    > contents of cells D23, D24, D26, D27, D28 & D29.
    >
    > Much thanks in advance!
    >
    > -Mike



+ 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