Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I change a Worksheet_change event to a beforesave event? | Excel Programming | |||
MsgBox in Enter event causes combobox not to run Change event | Excel Programming | |||
Change event and calculate event | Excel Programming | |||
Change Cell from Validated List Not Firing Worksheet Change Event | Excel Programming | |||
change event/after update event?? | Excel Programming |