Oke, Here is the code:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim ant As String
Application.EnableEvents = False
On Error Resume Next
If Not Application.Intersect(Target, ActiveSheet.Columns("L:L")) Is Nothing Then
'Target.Value = "j" by Default
If Target.Value <> "j" And Target.Value <> "n" Then
Target = ""
Target.Select
End If
Select Case Target.Value
Case "n"
Target.Offset(0, -4) = -1 * Abs(Val(Target.Offset(0, -4).Value))
Target.Offset(0, -6) = -1 * Abs(Val(Target.Offset(0, -6).Value))
Target.Offset(0, -6).NumberFormat = "0;[Red]0"
Case "j"
Target.Offset(0, -4) = Abs(Val(Target.Offset(0, -4).Value))
Target.Offset(0, -6) = Abs(Val(Target.Offset(0, -6).Value))
Target.Offset(0, -6).NumberFormat = "0;[Red]0"
Case ""
again:
ant = InputBox("j of n", "Kies j of n")
If Len(ant) = 0 Then GoTo again
If ant <> "j" And ant <> "n" Then GoTo again
Target = ant
If ant = "n" Then Target.Offset(0, -4) = -1 * Abs(Val(Target.Offset(0, -4).Value))
If ant = "j" Then Target.Offset(0, -4) = Abs(Val(Target.Offset(0, -4).Value))
Case Else
GoTo proceed
End Select
End If
proceed:
If Err.Number <> 0 Then
Call ErrorDescription("pfd", "Worksheet_Change") 'calls the function ErrorDescription
Err.Clear
End If
Application.EnableEvents = True
On Error GoTo 0
End Sub
The code is in Sheet("Pfd")
But i think there is nothing wrong with the code.
The worksheet in which the inputbox (sorry it was an inputbox, not a messagebox) shows up
contains no code.