» Replace value from validation list with a number using VBA in Microsoft Excel
CATEGORY - General Topics in VBA
VERSION - All Microsoft Excel Versions
The selection from a validity list in column D shall be replaced by a number. Works only with XL9 and higher.
Answer:
Place the code below into the This Workbook module.
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column <> 4 Then Exit Sub
Application.EnableEvents = False
Target.Value = WorksheetFunction.VLookup(Target.Value, Range("A1:B12"), 2, 0)
Application.EnableEvents = True
End Sub
Book Store:
Recommended Books:
- Microsoft Windows XP Registry Guide
- Rich Dad's Guide to Investing: What the Rich Invest in, That the Poor and the Middle Class Do Not!
- MP Managerial Accounting w/ Topic Tackler, Net Tutor, & PowerWeb
- Getting to Yes: Negotiating Agreement Without Giving In
- Financial Statement Analysis: A Practitioner's Guide, 3rd Edition
- Analysis of Financial Statements
No comments have been submitted.

