ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,736
- Office Version
- 2007
- Platform
- Windows
Hi,
Supplied is the current code in use.
I wish to expand the code to apply a number in the corresponding cell in column E
Target cells are currently in column D "name of shop" & now wish to also add in column E "mileage to that shop"
Currently if i enter 1 in the target cell i then see BANWELL NEWS appear, It is at this point i wish to also have 3 appear in the next cell to the right in column E, So my new databse for this would be like,
BANWELL NEWS 3
CHURCHILL POST OFFICE 6
HUTTON STORES 7
OLD MIXON MCCOLLS 8
THE CAXTON LIBRARY 2
HAYWOOD VILLAGE CO-OP 5
Have a nice day
Supplied is the current code in use.
I wish to expand the code to apply a number in the corresponding cell in column E
Target cells are currently in column D "name of shop" & now wish to also add in column E "mileage to that shop"
Currently if i enter 1 in the target cell i then see BANWELL NEWS appear, It is at this point i wish to also have 3 appear in the next cell to the right in column E, So my new databse for this would be like,
BANWELL NEWS 3
CHURCHILL POST OFFICE 6
HUTTON STORES 7
OLD MIXON MCCOLLS 8
THE CAXTON LIBRARY 2
HAYWOOD VILLAGE CO-OP 5
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("D5:D30")) Is Nothing Then
If UCase(Target.Value) = "1" Then Target.Value = "BANWELL NEWS"
If UCase(Target.Value) = "2" Then Target.Value = "CHURCHILL POST OFFICE"
If UCase(Target.Value) = "3" Then Target.Value = "HUTTON STORES"
If UCase(Target.Value) = "4" Then Target.Value = "OLD MIXON MCCOLLS"
If UCase(Target.Value) = "5" Then Target.Value = "THE CAXTON LIBRARY"
If UCase(Target.Value) = "6" Then Target.Value = "HAYWOOD VILLAGE CO-OP"
End If
If Not (Application.Intersect(Target, Range("A2:D30")) _
Is Nothing) Then
With Target
If Not .HasFormula Then
Application.EnableEvents = False
.Value = UCase(.Value)
Application.EnableEvents = True
End If
End With
End If
End Sub
Have a nice day