I have workbook with three sheets. The first sheet is designed for a user to enter data on a vehicle subject to a casualty loss. The second sheet calculates value of the vehicle at the time of the loss. This residual value is calculated on two different methods. The third sheet performs calculations based on the residual value, the insurance settlement, and amount needed to replace the vehicle. I need to perform one of two sets of compuations depending upon whether the insurance settlement exceeds the value of the vehicle or whether the insurance proceeds are less than the value of the vehicle at the time of loss.
I am using a worksheet event (Worksheet_Change(ByVal Target As Range)) on Sheet 1 where the insurance settlement is calculated.
Rows 15-64 are hidden. I do not seem to be getting any errors with the VBA code; however, regardless of the value entered in Sheet 1, cell $C$37, the rows on Sheet3 do not display. Any help would be appreciated.
I am using a worksheet event (Worksheet_Change(ByVal Target As Range)) on Sheet 1 where the insurance settlement is calculated.
VBA Code:
If Target.Address = "$C$37" Then //Sheet1 cell where insurance settlement value is entered
Dim RemFedInt As Long //Residual value
Dim InsSettlement As Long //insurance settlement value
RemFedInt = Sheets("Computations").Range("C18").Value
InsSettlement = Sheets("Computations").Range("C20").Value
If InsSettlement > RemFedInt Then //If insurance exceeds residual value, show cost computations in Sheet 3 ("Settlement Details"), rows 15-38
Sheets("Settlement Details").Rows("15:38").EntireRow.Hidden = False
Sheets("Settlement Details").Rows("39:64").EntireRow.Hidden = True
ElseIf InsSettlement < RemFedInt Then //If insurance settlement is less than residual value, show cost computations in Sheet 3 ("Settlement Details"), rows 39-64
Sheets("Settlement Details").Rows("15:38").EntireRow.Hidden = True
Sheets("Settlement Details").Rows("39:64").EntireRow.Hidden = False
Else //If no value for insurance settlement, hide all computation rows
Sheets("Settlement Details").Rows("15:38").EntireRow.Hidden = True
Sheets("Settlement Details").Rows("39:64").EntireRow.Hidden = True
End If
End If
End Sub
Rows 15-64 are hidden. I do not seem to be getting any errors with the VBA code; however, regardless of the value entered in Sheet 1, cell $C$37, the rows on Sheet3 do not display. Any help would be appreciated.