J
josros60 via OfficeKB.com
Hi,
I have a petty cash sheet, and there's one column for miscellaneous account,
so i have data validation list box so when i pick the account shows the
description and account but then i just want to display the account number
after i selected,by the way i have petty cash sheet and code sheet where it
pull the account from.
here it's the code for the petty cash sheet: ( i don't know what i am doing
wrong it display it put both but i just want the account number.
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo errHandler
If Target.Cells.Count > 1 Then GoTo exitHandler
If Target.Column = 2 Then
If Target.Value = "" Then GoTo exitHandler
Application.EnableEvents = False
Target.Value = Worksheets("Codes").Range("A1") _
.Offset(Application.WorksheetFunction _
.Match(Target.Value, Worksheets("Codes").Range("ProdList"), 0), 0)
End If
exitHandler:
Application.EnableEvents = True
Exit Sub
errHandler:
If Err.Number = 13 Or Err.Number = 1004 Then
GoTo exitHandler
Else
Resume Next
End If
End Sub
(is there anyway i can post the file so it's easy to know what i am talking
about, if any body want to use it, it's OK.
Thank you very much for your help
I have a petty cash sheet, and there's one column for miscellaneous account,
so i have data validation list box so when i pick the account shows the
description and account but then i just want to display the account number
after i selected,by the way i have petty cash sheet and code sheet where it
pull the account from.
here it's the code for the petty cash sheet: ( i don't know what i am doing
wrong it display it put both but i just want the account number.
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo errHandler
If Target.Cells.Count > 1 Then GoTo exitHandler
If Target.Column = 2 Then
If Target.Value = "" Then GoTo exitHandler
Application.EnableEvents = False
Target.Value = Worksheets("Codes").Range("A1") _
.Offset(Application.WorksheetFunction _
.Match(Target.Value, Worksheets("Codes").Range("ProdList"), 0), 0)
End If
exitHandler:
Application.EnableEvents = True
Exit Sub
errHandler:
If Err.Number = 13 Or Err.Number = 1004 Then
GoTo exitHandler
Else
Resume Next
End If
End Sub
(is there anyway i can post the file so it's easy to know what i am talking
about, if any body want to use it, it's OK.
Thank you very much for your help