+ Reply to Thread
Results 1 to 11 of 11

Any Formula For Automatic Deletion Of Entry?

Hybrid View

  1. #1
    Registered User
    Join Date
    05-16-2012
    Location
    Singapore
    MS-Off Ver
    Excel 97, Excel 2010
    Posts
    6

    Arrow Any Formula For Automatic Deletion Of Entry?

    Hey All,

    First of all I'm sorry if this is the wrong thread for posting my question. But I appreciate any help that can be given. I have an Excel sheet consisting ID number in cell B3:B31. Is there any formula or macros or anything that can be included so that, when I key in a particular ID maybe 34069, in any of the cells for example, B2, B6:B20 or maybe F3:F6, the same ID will be automatically deleted in within the cells of B3:B31. I've attached the file. Any help is greatly appreciated as this can help me a lot in my work of handling a near 1000 ID. Please help me.

    Thank You to All.
    Attached Files Attached Files
    Last edited by Dargio; 05-16-2012 at 04:44 AM.

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Any Formula For Automatic Deletion Of Entry?

    You say that the ID will be entered in either B2, B6:B20 or F3:F6 and it should be deleted from B3:B31. But you will be entering the number in B6:B20 and u want it to be deleted again?

    Please explain clearly.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    05-16-2012
    Location
    Singapore
    MS-Off Ver
    Excel 97, Excel 2010
    Posts
    6

    Re: Any Formula For Automatic Deletion Of Entry?

    ok sorry. what i meant was, if i key in any ID that is stated in within I3:I31 (my apologies for the wrong cell), into any of the other cells like B2 OR B6:B20 OR F3:F6, i want that particular ID to be automatically deleted from I3:I31. once again i apologise.

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Any Formula For Automatic Deletion Of Entry?

    Right click on the sheet where you need the code to work and select "View Code". Put this code in
    Option Explicit
    
    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim delid As Long
    Dim delcell As Variant
    
        If Not Intersect(Target, Range("$B$2,$B$6:$B$20,$F$3:$F$6")) Is Nothing Then
            delid = Target.Value
            Set delcell = Columns("I:I").Find(what:=delid, after:=Range("I1"), LookIn:=xlFormulas)
            If Not delcell Is Nothing Then
                delcell.Delete
            End If
        End If
    End Sub

  5. #5
    Registered User
    Join Date
    05-16-2012
    Location
    Singapore
    MS-Off Ver
    Excel 97, Excel 2010
    Posts
    6

    Re: Any Formula For Automatic Deletion Of Entry?

    erm.... another question, how do i put the code??? i'm a noob.... does it works with 97 excel and 2010?

  6. #6
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Any Formula For Automatic Deletion Of Entry?

    I am not sure about excel 97 (i learnt VBA only after excel 2003 came into use ). But it should work in 2010.

    Copy the code above, right click on your worksheet, select view code from the menu. Copy paste the code into the blank screen on the right.

  7. #7
    Registered User
    Join Date
    05-16-2012
    Location
    Singapore
    MS-Off Ver
    Excel 97, Excel 2010
    Posts
    6

    Re: Any Formula For Automatic Deletion Of Entry?

    k i tried. it works. sorry as i'm a bit too noob for this. can the IDs in one of the cells of I3:I31, be cleared instead of deleted like now?

  8. #8
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Any Formula For Automatic Deletion Of Entry?

    Sure, just change
     delcell.Delete
    to
     delcell.clear

  9. #9
    Registered User
    Join Date
    05-16-2012
    Location
    Singapore
    MS-Off Ver
    Excel 97, Excel 2010
    Posts
    6

    Re: Any Formula For Automatic Deletion Of Entry?

    I am really sorry to bug u with my questions again n again. clear works fine, but is it possible just to delete entry and let the colored cells stay instead of clearing the whole cell to stock? i am really sorry again....

  10. #10
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Any Formula For Automatic Deletion Of Entry?

    Then try replacing .clear with .clearcontents

  11. #11
    Registered User
    Join Date
    05-16-2012
    Location
    Singapore
    MS-Off Ver
    Excel 97, Excel 2010
    Posts
    6

    Re: Any Formula For Automatic Deletion Of Entry?

    yay!!! it works!!!!! thanks alot arlette!!! i appreciate it alot!!!!!

+ 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