You'd have to do this with VBA. You cant have a formula for the Account Code AND the Account Description.
You need a WorkSheet Change Event which will look something like:
Private Sub Worksheet_Change(ByVal Target As Range)
' Formulae used
' ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-1],Setup!RC[-4]:R[100]C[-3],2,FALSE)"
' ActiveCell.FormulaR1C1 = _
' "=INDEX(GL_Account_Code,MATCH(RC[1],GL_Account_Description,0))"
' Exit subroutine if changed cell is not in column E or F
If Intersect(Target, Columns("E:F")) Is Nothing Then Exit Sub
' Exit subroutine if changed cell is in heading area
If Target.Row < 4 Then Exit Sub
' Exit subroutine if changed cell is in test area
If Target.Row > 12 Then Exit Sub
' Named Ranges required in formulae below
' GL_Account_Code = Range("B4:B104")
' GL_Account_Description = Range("C4:C104")
' GL_Table = Range("B4:C104")
If Target.Column = 5 Then
Application.EnableEvents = False
Target.Offset(0, 1).Value = Application.WorksheetFunction.VLookup( _
Target, _
Sheets("Setup").Range("GL_Table"), _
2, False)
Application.EnableEvents = True
End If
If Target.Column = 6 Then
Application.EnableEvents = False
Target.Offset(0, -1).Value = Application.WorksheetFunction.Index( _
Sheets("Setup").Range("GL_Account_Code"), _
Application.WorksheetFunction.Match( _
Target, _
Sheets("Setup").Range("GL_Account_Description"), _
0))
Application.EnableEvents = True
End If
End Sub
You'll need to remove the existing formula but retain both drop down lists.
Regards
Bookmarks