Change Event
I'm using the Worksheet_Change Event to put som information in Column D if
changes happens i Column C. If I type ie anything in C3, "ABC" is added in D3. I Can later Delete the "ABC" manually. This works perfectly allrigt. My problem is, that if I Delete the contents og C3 then I do not want D3 to change. So is thefre a way I can check if the change is a Clearcontent. I've tried with Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column = 3 And Target.ClearContents = True Then Exit Sub Else If Target.Column = 3 Then If Range("D" & Target.Row) = "" Then Range("D" & Target.Row) = Range("INITIALER").Value End If End If End If End Sub But that makes anything types i Columsn C to be deleted. Jan |
Change Event
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 3 And Target.Value = "" Then Exit Sub Else If Target.Column = 3 Then If Range("D" & Target.Row) = "" Then Range("D" & Target.Row) = Range("INITIALER").Value End If End If End If End Sub -- Gary''s Student - gsnu2007c "Jan Kronsell" wrote: I'm using the Worksheet_Change Event to put som information in Column D if changes happens i Column C. If I type ie anything in C3, "ABC" is added in D3. I Can later Delete the "ABC" manually. This works perfectly allrigt. My problem is, that if I Delete the contents og C3 then I do not want D3 to change. So is thefre a way I can check if the change is a Clearcontent. I've tried with Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column = 3 And Target.ClearContents = True Then Exit Sub Else If Target.Column = 3 Then If Range("D" & Target.Row) = "" Then Range("D" & Target.Row) = Range("INITIALER").Value End If End If End If End Sub But that makes anything types i Columsn C to be deleted. Jan |
Change Event
Of Course! Thank you.
Jan Gary''s Student wrote: Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column = 3 And Target.Value = "" Then Exit Sub Else If Target.Column = 3 Then If Range("D" & Target.Row) = "" Then Range("D" & Target.Row) = Range("INITIALER").Value End If End If End If End Sub I'm using the Worksheet_Change Event to put som information in Column D if changes happens i Column C. If I type ie anything in C3, "ABC" is added in D3. I Can later Delete the "ABC" manually. This works perfectly allrigt. My problem is, that if I Delete the contents og C3 then I do not want D3 to change. So is thefre a way I can check if the change is a Clearcontent. I've tried with Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column = 3 And Target.ClearContents = True Then Exit Sub Else If Target.Column = 3 Then If Range("D" & Target.Row) = "" Then Range("D" & Target.Row) = Range("INITIALER").Value End If End If End If End Sub But that makes anything types i Columsn C to be deleted. Jan |
All times are GMT +1. The time now is 09:48 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com