Looking for alternative code to one currently in use

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,279
Office Version
  1. 2007
Platform
  1. Windows
I have the following code in use.
Its currently in cell P7

It works & does what it should do but it breaks so easily in respect of the code not being assigned to the cell P7 or if i manually type in the cell P7 the formula is gone.

Code:
=IF(N7="LAND ROVER","G",IF(N7="BMW MINI","X",IF(N7="ROVER","N",IF(N7="SUSPENSION","M",""))))

So i am looking for something a little more robust as im currently having to type the formula back in.

Thanks
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Well ive come up with this code from another sheet.
It doesnt give me an error but i cant believe myself.



Code:
Private Sub Worksheet_Change(ByVal Target As Range)     
    Application.EnableEvents = False
    
    If Not Application.Intersect(Target, Range("E6,F6,G6,H6,I6,J6,E7,P6,P7,Q6,R6,S6,T6,U6")) Is Nothing Then
        Target(1).Value = UCase(Target(1).Value)
    End If
    If Not Intersect(Target, Range("N7")) Is Nothing Then


       If UCase(Target.Value) = "LAND ROVER DISCO II" Then Range("P7").Value = "G"
       If UCase(Target.Value) = "BMW MINI" Then Range("P7").Value = "X"
       If UCase(Target.Value) = "ROVER 75" Then Range("P7").Value = "N"
       If UCase(Target.Value) = "SUSPENSION FOB" Then Range("P7").Value = "M"


End If
    Application.EnableEvents = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,216,228
Messages
6,129,621
Members
449,521
Latest member
Anri

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top