Please could somebody tell me the VB code or function to clear cell contents with user input in the adjacent cell
Thanks
Ashley
Please could somebody tell me the VB code or function to clear cell contents with user input in the adjacent cell
Thanks
Ashley
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.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks