+ Reply to Thread
Results 1 to 2 of 2

Clear 4 x Cells Every 2 Minutes At Top of Spreadsheet

Hybrid View

  1. #1
    Registered User
    Join Date
    04-14-2015
    Location
    Lincoln, UK
    MS-Off Ver
    2013
    Posts
    37

    Clear 4 x Cells Every 2 Minutes At Top of Spreadsheet

    Hello -

    I've found a few posts / ideas that come close (but can't stop my spreadsheet from crashing when activating?)

    I have a primitive search function at the top of my sheet that will give a search-specific dropdown in cells O2 and O4 based on codes or keywords inputted into K2 and K4 respectively.

    I would like these 4 x cells' contents to reset/blank (i.e. 'clear' not delete) every 2 minutes (but not the dropdown functions themselves for O2 and O4) (please note, they are merged cells at the moment and some of the VBA doesn't like that, if they need un-merging, so be it!) so users can keep using it without clearing the cells with a physical delete.

    Alternatively, if its difficult to do based on timing, if the main body of the sheet (A8: AO200) is accessed, then it then blanks, this would also be OK as an alternative?

    Any help would be very appreciated

    Thanks

  2. #2
    Valued Forum Contributor dotchiejack's Avatar
    Join Date
    05-21-2015
    Location
    Antwerp,Belgium
    MS-Off Ver
    2016
    Posts
    507

    Re: Clear 4 x Cells Every 2 Minutes At Top of Spreadsheet

    Put this code in a standaard module. Start timer.
    Public RunWhen As Double
    Public Const cRunWhat = "my_Procedure"
    Sub StartTimer()
    RunWhen = Now + TimeSerial(0, 2, 0)
    Application.OnTime earliesttime:=RunWhen, procedure:=cRunWhat, _
         schedule:=True
    End Sub
    Sub StopTimer()
       On Error Resume Next
       Application.OnTime earliesttime:=RunWhen, _
           procedure:=cRunWhat, schedule:=False
    End Sub
    Sub my_Procedure()
        Sheets("Blad1").Range("K2,K4,O2,O4").ClearContents
        Call StartTimer
    End Sub
    be sure to run StopTimer before exiting Excel
    I didn't test it on merged cells.
    Click the * Add Reputation below to say thanks.

+ 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. Clear Spreadsheet !
    By ionelz in forum Excel General
    Replies: 1
    Last Post: 11-28-2017, 01:01 AM
  2. VBA to Clear 1 Cell and Clear other cells Formula only
    By oneblondebrow in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-17-2017, 12:56 PM
  3. Day into Hours into Minutes Calculator Spreadsheet
    By jeph_oliver in forum Excel Formulas & Functions
    Replies: 33
    Last Post: 02-27-2015, 03:13 PM
  4. Clear the cell before closing the spreadsheet
    By katypoly25 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-23-2013, 08:05 AM
  5. Clear range of cells 'to the bottom of the spreadsheet'
    By colorrider in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-29-2010, 09:51 AM
  6. Using control to clear spreadsheet
    By dvonj in forum Excel General
    Replies: 13
    Last Post: 03-20-2006, 06:35 AM
  7. [SOLVED] Clear spreadsheet cells format
    By Souris in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-19-2005, 07:05 PM

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