View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
mrice mrice is offline
external usenet poster
 
Posts: 1
Default Deleting unwanted data by macro or...


Try the following user defined function which you need to place on the
tab corresponding to your sheet of data (e.g. sheet1) in the VBA
editor.

Private Sub Worksheet_Change(ByVal Target As Range)
MaxColumn = 5
If Target.Column = MaxColumn And Target.Columns.Count = 1 And
Target.Rows.Count = 1 And IsNumeric(Target) Then
For N = MaxColumn - 1 To Int(Target.Value) + 2 Step -1
Cells(Target.Row, N).ClearContents
Next N
End If
End Sub


--
mrice

Research Scientist with many years of spreadsheet development experience
------------------------------------------------------------------------
mrice's Profile: http://www.excelforum.com/member.php...o&userid=10931
View this thread: http://www.excelforum.com/showthread...hreadid=571193