+ Reply to Thread
Results 1 to 4 of 4

VBA if any value in a range changes, clear contents of other cells.

  1. #1
    Registered User
    Join Date
    09-18-2015
    Location
    Milwaukee
    MS-Off Ver
    2007
    Posts
    15

    VBA if any value in a range changes, clear contents of other cells.

    I have a worksheet where I have VBA set to clear the contents of some cells whenever the value of J5 changes. I'm using this code:

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Range("J5")) Is Nothing Then
    If Range("J5") <> "" Then Range("F4:F58, E42:E58").ClearContents
    End If

    I want to modify this so it checks if ANY value in J5:J10 changes, then clears those same cells F4:F58, E42:E58

    Any suggestions? I tried just changing ("J5") to ("J5:J10") in both parts of the code but apparently it's not that simple.

    Thank you in advance!

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: VBA if any value in a range changes, clear contents of other cells.

    Try this...

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    09-18-2015
    Location
    Milwaukee
    MS-Off Ver
    2007
    Posts
    15

    Re: VBA if any value in a range changes, clear contents of other cells.

    perfection, thank you!

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: VBA if any value in a range changes, clear contents of other cells.

    You're welcome.

+ 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. [SOLVED] Clear the contents of Unprotected cells - EXCEPT a certain range
    By ronkeakano in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 11-13-2015, 01:40 PM
  2. [SOLVED] Event to check cells in Range("I207:I216") contains number ealse clear contents
    By mangesh.mehendale in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-12-2015, 12:07 AM
  3. Clear Contents of Dependent DropDowns in a range but keep formulas for those cells
    By jeffclanders in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-22-2015, 10:51 AM
  4. [SOLVED] Macro to Clear contents in a range of cells when Date change.
    By aneshdas in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-08-2014, 01:53 AM
  5. Replies: 6
    Last Post: 06-05-2013, 12:14 AM
  6. Replies: 18
    Last Post: 02-10-2013, 05:32 PM
  7. Clear contents of cells in a range, LEN=0
    By jenny_journalist in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-29-2009, 11:37 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