+ Reply to Thread
Results 1 to 4 of 4

Formula / function for clearing cells that require input

  1. #1
    Registered User
    Join Date
    09-24-2022
    Location
    Perth, Australia
    MS-Off Ver
    2021 PRO
    Posts
    13

    Formula / function for clearing cells that require input

    Hi all - is there a formula / function / macro (although I don't have any experience in creating macros) that can be used to clear cells that require input?

    e.g. refer to the sample attachment.

    If I click on cell C11 in the "Input date" sheet, I'd like the values at cells B12:B17 (Job 1 tab), B12:B17 (Job 2 tab) and B12:B15 (Job 3 tab) to be cleared to blank. Is this possible?
    Attached Files Attached Files

  2. #2
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,477

    Re: Formula / function for clearing cells that require input

    There is no "single click" event for cell, but "double click"
    Right click on tab name, view code, then paste below code into.
    This code trigger "double click" event on cell C11:
    PHP Code: 
    Option Explicit
    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As RangeCancel As Boolean)
    If 
    Target.Address(00) <> "C11" Then Exit Sub
    Sheets
    ("Job 1").Range("B12:B17").ClearContents
    Sheets
    ("Job 2").Range("B12:B17").ClearContents
    Sheets
    ("Job 3").Range("B12:B15").ClearContents
    Cancel 
    True
    End Sub 
    Quang PT

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,496

    Re: Formula / function for clearing cells that require input

    There is no "single click" event for cell, . . .
    Is that not the Worksheet Selection Change Event handler?
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,477

    Re: Formula / function for clearing cells that require input

    Quote Originally Posted by TMS View Post
    Is that not the Worksheet Selection Change Event handler?
    No, to avoid single click by change...

+ 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. Formula / function for clearing cells that require input
    By amar87 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-26-2022, 11:10 AM
  2. Formula / function for clearing cells that require input
    By amar87 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-26-2022, 10:18 AM
  3. Replies: 2
    Last Post: 11-13-2019, 11:26 PM
  4. Replies: 6
    Last Post: 11-11-2016, 09:07 PM
  5. [SOLVED] How to adjust codes to require input to desired cells Only?
    By yl41012 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-19-2016, 04:42 PM
  6. ClearContents function is clearing unselected cells
    By ndbwhunter in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-01-2015, 12:14 PM
  7. Require input data in certain cells if other cells are filled before saving
    By Jenkins86 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-01-2013, 08:07 PM

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