Ive found a code that im using in a project but im having trouble with it. It works fine but I want my dropdown menu to interact something else when i choose "delete".
Im making a exercise program in Excel for a friend of mine and ive used the following code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$C$2" Then
If Range("I2") = "" Then
Range("I2") = Target.Value
Range("J2") = Format(Now, "dd.mm.yy kl.hh:mm")
Else
Range("I" & Rows.Count).End(xlUp).Offset(1) = Target.Value
Range("J" & Rows.Count).End(xlUp).Offset(1) = Format(Now, "dd.mm.yy kl.hh:mm")
End If
End If
If Target.Address = "$C$3" Then
If Range("L2") = "" Then
Range("L2") = Target.Value
Range("M2") = TimeSerial(Hour(Time), Minute(Time), 0)
Else
Range("L" & Rows.Count).End(xlUp).Offset(1) = Target.Value
Range("M" & Rows.Count).End(xlUp).Offset(1) = TimeSerial(Hour(Time), Minute(Time), 0)
End If
End If
If Target.Address = "$C$4" Then
If Range("O2") = "" Then
Range("O2") = Target.Value
Range("P2") = TimeSerial(Hour(Time), Minute(Time), 0)
Else
Range("O" & Rows.Count).End(xlUp).Offset(1) = Target.Value
Range("P" & Rows.Count).End(xlUp).Offset(1) = TimeSerial(Hour(Time), Minute(Time), 0)
End If
End If
End Sub
The dropdown menu ive used is made by datavalidation. Each time I chose an item from my dropdown menu I get the option shown in for example the column "I2". And when I choose the next item it wil show this selected value on the next row. At the same time date and time appears beside the option ive chosen. My problem is:
When i select "delete" from my dropdown menu the previous row should become blank(both the dat/time and the option i made earlier). Ive searched the web after a similar problem but i havent found a solution yet. Im hoping some genious in this forum might help me with this problem.
Bookmarks