I am developing a simple general ledger for employees to use for expense tracking. I want the contents of each cell in Column E to change to a negative value based on the content of the adjacent cell in Column F. Column F is restricted to a drop down list. When the employee chooses "Journal Entry - Credit" the value in Column E should change to a negative. I think VBA is required for this, but have been unable to get it to work.
I'm using the code below, adopted from a post I found on the forum, but not getting the negative value.
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim cell As Range
Application.EnableEvents = False
For Each cell In Target
If Not Intersect(cell, Range("F:F")) Is Nothing Then
Select Case Trim(LCase(cell.Value))
Case "Journal Entry - Credit"
Cells(Target.Row, "E") = Abs(Cells(Target.Row, "E")) * -1
Case Else
Cells(Target.Row, "E") = Abs(Cells(Target.Row, "E"))
End Select
End If
Next cell
Application.EnableEvents = True
End Sub
Bookmarks