Cell Recognise Whole Word from its Initial

rr1050

New Member
Joined
Jan 10, 2009
Messages
24
Hello there,

I require in Column R & S only in “DataInput” sheet, when I wrote in cell.
w then automatic comes Winner & l for Looser.

Require VBA coding.

Regards, Rahul
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
I require in Column R & S only in “DataInput” sheet, when I wrote in cell.
w then automatic comes Winner & l for Looser.
Right click the tab for your DataInput sheet and select "View Code" from the popup menu that appears, then copy/paste the following code into the code window that opens up...
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
  If Target.Count = 1 And (Target.Column = 18 Or Target.Column = 19) Then
    Application.EnableEvents = False
    Select Case Target.Value
      Case "L", "l": Target.Value = "Loser"
      Case "W", "w": Target.Value = "Winner"
    End Select
    Application.EnableEvents = True
  End If
End Sub
The above event code should now work the way you want.
 
Last edited:
Upvote 0
Right click the tab for your DataInput sheet and select "View Code" from the popup menu that appears, then copy/paste the following code into the code window that opens up...
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
  If Target.Count = 1 And (Target.Column = 18 Or Target.Column = 19) Then
    Application.EnableEvents = False
    Select Case Target.Value
      Case "L", "l": Target.Value = "Loser"
      Case "W", "w": Target.Value = "Winner"
    End Select
    Application.EnableEvents = True
  End If
End Sub
The above event code should now work the way you want.

Mr. Rick Many many thanks for your help and time.
 
Upvote 0
Another alternative which avoids VBA that might be of interest to you.
Set up Data Validation in these two columns, with the two options of "Winner" and "Loser".
Then, they wouldn't need to type anything, just select the option they want.
 
Upvote 0
Thanks Joe

VBA was requirement, I have many words and complicated type each one.
Appreciated your help too.
 
Last edited:
Upvote 0
That's fine. I just mentioned it because I see many people ask for VBA because they are not always aware of the non-VBA options that might exist.
Keep in mind that you could also just have a running list somewhere in Excel (like on a hidden sheet), and the Data Validation can reference that list.
Either way, you are going to be typing an initial list in Excel or in VBA.
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

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