+ Reply to Thread
Results 1 to 2 of 2

Delete cell contents with input to adjacent cell

  1. #1
    Registered User
    Join Date
    08-21-2005
    Posts
    8

    Delete cell contents with input to adjacent cell

    Please could somebody tell me the VB code or function to clear cell contents with user input in the adjacent cell

    Thanks

    Ashley

  2. #2
    Dave O
    Guest

    Re: Delete cell contents with input to adjacent cell

    This code worked for me:

    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim CurrentCell As String
    If Mid(Target.Address, 2, Len(Target.Address) - InStr(2,
    Target.Address, "$")) = "B" Then
    CurrentCell = ActiveCell.Address
    Range(Target.Address).Select
    ActiveCell.Offset(0, -1).Value = ""
    Range(CurrentCell).Select
    End If
    End Sub

    In the VB editor's project pane, right click the relevant tab name,
    select View Code, and paste that code in.

    Note: the line that says "If Mid(Target.Address, 2, Len(.... etc" is
    there to limit this action to a particular column. The code only runs
    if the user makes an entry in the column you specify, then erases the
    cell to the immediate left of the cell in which the change was made.


+ 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