+ Reply to Thread
Results 1 to 12 of 12

Excel auto delete cells or self destruct

Hybrid View

  1. #1
    Forum Contributor ryan4646's Avatar
    Join Date
    06-10-2013
    Location
    Australia
    MS-Off Ver
    Excel 2003, 2007
    Posts
    134

    Excel auto delete cells or self destruct

    can excel automatically delete cells or rows ? can it self destruct the whole file as well ??

    sorry for this question. But i believe if any genius can figure it out ?
    thanks,

    Ryan

  2. #2
    Forum Contributor noboffinme's Avatar
    Join Date
    08-29-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2003/7/10/13/16/19
    Posts
    1,071

    Re: Excel auto delete cells or self destruct

    Hi ryan4646,

    Excel can delete cells or rows if you tell it to such as writing a Macro to do so.

    Excel doesn't self destruct unless a file is corrupted / damaged in some way.

    Hth
    Remember you are unique, like everyone else

  3. #3
    Forum Contributor ryan4646's Avatar
    Join Date
    06-10-2013
    Location
    Australia
    MS-Off Ver
    Excel 2003, 2007
    Posts
    134

    Re: Excel auto delete cells or self destruct

    Hi hth

    so is that possible to assign a macro to delete rows in a specific date ? e:g : today is 22nd and i want some cells will be deleted at 24th.

  4. #4
    Forum Contributor noboffinme's Avatar
    Join Date
    08-29-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2003/7/10/13/16/19
    Posts
    1,071

    Re: Excel auto delete cells or self destruct

    Hi,

    I'm noboffinme, Hth means Hope this Helps.

    Yes, a Macro can delete data based on some rule you create.

  5. #5
    Forum Contributor ryan4646's Avatar
    Join Date
    06-10-2013
    Location
    Australia
    MS-Off Ver
    Excel 2003, 2007
    Posts
    134

    Re: Excel auto delete cells or self destruct

    Can you suggest me a macro like this ?

  6. #6
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,446

    Re: Excel auto delete cells or self destruct

    so the macro must delete those rows in the future, the day after tomorrow ?
    That's possible with on application.ontime, but the file must be open at that moment, otherwise nothing happens or he can do it later as you reopens your file.
    2 macros, the 1st in ThisWorkbook and the 2nd in module1
    macro for in thisworkbook
    Private Sub Workbook_Open()
      Dim dCritical As Date
      dCritical = DateSerial(2013, 12, 24) + TimeValue("11:30")  'at this moment you want to delete that cell if that map is open
      Select Case Now - dCritical                              'what is the actual moment
        Case Is < 0: Application.OnTime dCritical, "DeleteSomeCells"  'ciritical moment is still in the future
        Case 0 To 7: DeleteSomeCells                           'up to 7 days after that critical moment, you still delete those cells
      End Select
    End Sub
    
    macro for in module1
    Sub DeleteSomeCells()
      Sheets("blad1").Range("A5:D10").ClearContents            '<-- blad1 is the name of the tab in which you want to delete
    End Sub

  7. #7
    Forum Contributor ryan4646's Avatar
    Join Date
    06-10-2013
    Location
    Australia
    MS-Off Ver
    Excel 2003, 2007
    Posts
    134

    Re: Excel auto delete cells or self destruct

    HI bsalv ,

    so after inserting these code, after 7 days it will auto delete cells ? sorry i am weak at macro.

    Quote Originally Posted by bsalv View Post
    so the macro must delete those rows in the future, the day after tomorrow ?
    That's possible with on application.ontime, but the file must be open at that moment, otherwise nothing happens or he can do it later as you reopens your file.
    2 macros, the 1st in ThisWorkbook and the 2nd in module1
    macro for in thisworkbook
    Private Sub Workbook_Open()
      Dim dCritical As Date
      dCritical = DateSerial(2013, 12, 24) + TimeValue("11:30")  'at this moment you want to delete that cell if that map is open
      Select Case Now - dCritical                              'what is the actual moment
        Case Is < 0: Application.OnTime dCritical, "DeleteSomeCells"  'ciritical moment is still in the future
        Case 0 To 7: DeleteSomeCells                           'up to 7 days after that critical moment, you still delete those cells
      End Select
    End Sub
    
    macro for in module1
    Sub DeleteSomeCells()
      Sheets("blad1").Range("A5:D10").ClearContents            '<-- blad1 is the name of the tab in which you want to delete
    End Sub

  8. #8
    Forum Contributor noboffinme's Avatar
    Join Date
    08-29-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2003/7/10/13/16/19
    Posts
    1,071

    Re: Excel auto delete cells or self destruct

    I can show you how to do this.

    Do you have any VBA experience to write a Macro?

    Can you send me a file & advise what rules the Macro should use to delete the files?

    Thanks

  9. #9
    Forum Contributor ryan4646's Avatar
    Join Date
    06-10-2013
    Location
    Australia
    MS-Off Ver
    Excel 2003, 2007
    Posts
    134

    Re: Excel auto delete cells or self destruct

    Quote Originally Posted by noboffinme View Post
    I can show you how to do this.

    Do you have any VBA experience to write a Macro?

    Can you send me a file & advise what rules the Macro should use to delete the files?

    Thanks
    Hi noboffinme,

    i have experience to copy and paste, nothing more .

    Yes, for example i want to delete the rows from A4:A106. actually if it is possible please help me to learn to put code if want to delete any cells,specially all cells,any file when i want. thanks in advance.
    Attached Files Attached Files

  10. #10
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,446

    Re: Excel auto delete cells or self destruct

    As long as your workbook isn't open, the macro can do nothing.
    Suppose you want to autodelete some cells at 2013-12-31 11:00
    * 1st possibility : workbook is opened before that moment, the macro "Workbook_Open" planned a procedure for that moment and at that moment the macro "DeleteSomeCells" 'll run.
    * 2nd possibility (+dangereous situation) : up to 7 days after that moment, every time, at the moment you open that workbook, it 'll immediately run that macro "DeleteSomeCells".
    In that macro I didn't delete cells, i just cleared the contents. But you have to think seriously about the dangers.
    Perhaps you want that the macro only runs 1 time, so you must somewhere create a kind of flag, so that you block the macro to run a 2nd time.

    Perhaps it's better that you describe good what you really want.

  11. #11
    Forum Contributor ryan4646's Avatar
    Join Date
    06-10-2013
    Location
    Australia
    MS-Off Ver
    Excel 2003, 2007
    Posts
    134

    Re: Excel auto delete cells or self destruct

    Hi bsalv,
    i attached a file above.i want to delete those cells automatically after three days from now.

  12. #12
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,446

    Re: Excel auto delete cells or self destruct

    see attachment
    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)

Similar Threads

  1. [SOLVED] VBA code needed to add auto serial number, delete blank row & merge cells
    By krjoshi in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 07-28-2021, 06:50 AM
  2. Auto Delete three cells on Aniversary (date)
    By shaun0_0 in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 12-16-2008, 08:43 PM
  3. auto delete cells according to date
    By LiquidDragon in forum Excel General
    Replies: 3
    Last Post: 12-06-2008, 12:55 PM
  4. [SOLVED] Auto-delete Unbolded Cells
    By John Walker in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-30-2006, 04:40 PM
  5. [SOLVED] macro for self destruct
    By jwduthler in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-09-2005, 11:05 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