Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bill Fitzgerald
 
Posts: n/a
Default A letter to generat a number when entered into anywhere on the spr

I would like to know how to have a letter generate a number when placed in a
cell randomly on a spreadsheet. For example anytime a P is placed in a cell
it would automatically equal 8

Thank You for your assistance.


Bill Fitzgerald
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
davesexcel
 
Posts: n/a
Default A letter to generat a number when entered into anywhere on the spr


=LOOKUP(C1,A1:B7,B1:B7)
C1 is the criteria
column A
a
b
c
d
e
f
g

column B
1
2
3
4
5
6
7

adjust the range and values to what you require


--
davesexcel


------------------------------------------------------------------------
davesexcel's Profile: http://www.excelforum.com/member.php...o&userid=31708
View this thread: http://www.excelforum.com/showthread...hreadid=536254

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ken Johnson
 
Posts: n/a
Default A letter to generat a number when entered into anywhere on the spr

Hi Bill,
If you want a "P" that has been entered into any cell to automatically
convert to an "8" in that same cell then you would probably have to use
a Worksheet_Change Event Procedure in that worksheet's code module.
This example changes "p" or "P" to 8 and "l" or "L" to 12.

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
On Error GoTo ERRORHANDLER
Select Case UCase(Target.Value)
Case "P"
Target.Value = 8
Case "L"
Target.Value = 12
End Select
Application.EnableEvents = True
Exit Sub
ERRORHANDLER: Application.EnableEvents = True
End Sub


Adjust the code to suit your needs just by adding more (or deleting)
pairs of lines such as..

Case "some other letter"
Target.Value = some other number

If case sensitivity is needed then change...

Select Case UCase(Target.Value)

to...

Select Case Target.Value

and use the appropriate letter case in the Case statement
(Case "P" or Case "p")

To get the code in place...

1.Copy it
2. Right click the worksheet's tab.
3. Choose "View code" from the popup
4. Paste the code

The workbook now has a macro so ToolsMacroSecurityMedium.
Next time the book is opened click on Enable Macros on the Security
Warning dialog.

Ken Johnson

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can excel give value in words of number entered in another cell? nivedrajesh Excel Worksheet Functions 4 October 27th 06 02:57 PM
How do I convert a given number into a letter? vortex0001 Excel Worksheet Functions 5 September 8th 05 10:09 AM
Assigning a number value to a letter? Orphan86 Excel Discussion (Misc queries) 3 August 30th 05 11:45 PM
How to return a dollar value for a part number entered in a cell free2bjmg Excel Worksheet Functions 3 July 24th 05 01:26 AM
how to add a letter in front of each number in a cell nmodafferi Excel Discussion (Misc queries) 15 June 16th 05 08:58 PM


All times are GMT +1. The time now is 10:50 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"