Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Ashley Frank
 
Posts: n/a
Default 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

  #2   Report Post  
Dave O
 
Posts: n/a
Default

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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Function syntax to compare cell contents ES Excel Worksheet Functions 2 May 18th 05 03:53 PM
How do I find the contents of a cell using the "ADDRESS" function. sweeney Excel Worksheet Functions 2 April 5th 05 03:23 AM
Delete Cell Value Based on Another Cell T or F DocuMike Excel Discussion (Misc queries) 3 January 5th 05 08:46 PM
Cell contents vs. Formula contents Sarah Excel Discussion (Misc queries) 3 December 15th 04 06:02 PM
Display actual contents of cell xmasbob Excel Discussion (Misc queries) 1 December 6th 04 05:09 PM


All times are GMT +1. The time now is 09:50 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"