View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Steve E Steve E is offline
external usenet poster
 
Posts: 62
Default Macro to clear range contents when cell contents are changed b

THANKS!

I tried:
Range("L" & Rchange, "T" & Rchange).ClearContents

and it seemed to work... does this pose any problems so that I should use the

Range("L" & Rchange, "T" & Rchange).Value = vbNullString

that you suggested instead?

This stuff is great... I really need to learn VB I think. Any suggestions
on how to get edumacated?

Thanks!
"stevebriz" wrote:

try this:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim Rchange As Integer
Rchange = Target.Row ' row number selected
If Rchange 17 And Rchange < 35 Then ' make sure only applies to
rows 18 to 34
If Target.Address = "$D" & "$" & Rchange Then
'MsgBox "Target address changed :" & Target.Address
Range("L" & Rchange, "T" & Rchange).Value = vbNullString '
clears cells for in this row for cols L to T
MsgBox "Range: " & " L" & Rchange & " to " & " T" &
Rchange & " Cleared" ' optional
End If
Else
End If
End Sub