![]() |
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 -- Ashley Frank ------------------------------------------------------------------------ Ashley Frank's Profile: http://www.excelforum.com/member.php...o&userid=26488 View this thread: http://www.excelforum.com/showthread...hreadid=473396 |
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. |
All times are GMT +1. The time now is 06:50 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com