I have two macros assigned to buttons that do basically the same thing. They draw info from cells in another worksheet ("Combined") based on the active cell ("Property Name") then display them in a message box. The second macro is giving me a runtime error 5 on the line beginning with "maturity".
Sub PropertyInfo()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Dim ArrayRange As Variant
Dim ActCell As Variant
Set ActCell = ActiveCell
PropertyName = ActiveCell.Value
If IsEmpty(ActiveCell) = True Or IsNumeric(ActiveCell) = True Then
MsgBox "Please select Property Name"
Else
Sheets("Combined").Select
ArrayRange = Sheets("Combined").Range(Range("F1"), Range("F1").SpecialCells(xlLastCell))
Sheets("Pivot").Select
Maturity = Application.WorksheetFunction.VLookup(ActCell, ArrayRange, 36, False)
Lender = Application.WorksheetFunction.VLookup(ActCell, ArrayRange, 41, False)
Originator = Application.WorksheetFunction.VLookup(ActCell, ArrayRange, 42, False)
Address = Application.WorksheetFunction.VLookup(ActCell, ArrayRange, 2, False)
MsgBox "Property Name: " & PropertyName & vbCrLf & vbCrLf & "Loan Maturity: " & Maturity & vbCrLf & vbCrLf & "Lender: " & Lender & vbCrLf & vbCrLf & "Originator: " & Originator & vbCrLf & vbCrLf & "Property Address: " & Address & vbCrLf & vbCrLf & "Note: If dates are blank, the database doesnt have the info."
Application.ScreenUpdating = True
End If
End Sub
end result will display the messagebox with Maturity, Lender, Originator, and Address