#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 126
Default Numbers For Letters

Hi

Could someone show me the codes for the following problem?

I want a Macro that should do the following?

If cells(1,1)="abc" then I want cells(1,2) to show 123
If cells(1,1)="bac" then I want cells(1,2) to show 213
If cells(1,1)="cba" then I want cells(1,2) to show 321

Thanks.

M Varnendra
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Numbers For Letters

Hi,

Several ways and here's one

Sub lime()
Select Case Cells(1, 1).Value
Case Is = "abc"
Cells(1, 2) = 123
Case Is = "bac"
Cells(1, 2) = 213
Case Is = "cba"
Cells(1, 2) = 321
Case Else
End Select
End Sub


Mike

"Varne" wrote:

Hi

Could someone show me the codes for the following problem?

I want a Macro that should do the following?

If cells(1,1)="abc" then I want cells(1,2) to show 123
If cells(1,1)="bac" then I want cells(1,2) to show 213
If cells(1,1)="cba" then I want cells(1,2) to show 321

Thanks.

M Varnendra

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 126
Default Numbers For Letters

Hi Mike

Sorry if my information is misleading but I need the codes to generate
numbers to cover every permutation generated via the key board. Actually I
gave the 'abc' as an example. If somebody puts in 'Tim' in cells(1,1) then
the number generated should be 20913 meaning 20 for t, 9 for i and 13 for m.
Do you have a solution?

Thanks
M Varnendra

"Mike H" wrote:

Hi,

Several ways and here's one

Sub lime()
Select Case Cells(1, 1).Value
Case Is = "abc"
Cells(1, 2) = 123
Case Is = "bac"
Cells(1, 2) = 213
Case Is = "cba"
Cells(1, 2) = 321
Case Else
End Select
End Sub


Mike

"Varne" wrote:

Hi

Could someone show me the codes for the following problem?

I want a Macro that should do the following?

If cells(1,1)="abc" then I want cells(1,2) to show 123
If cells(1,1)="bac" then I want cells(1,2) to show 213
If cells(1,1)="cba" then I want cells(1,2) to show 321

Thanks.

M Varnendra

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,345
Default Numbers For Letters

Try something like:

Sub NumberIt()
Dim CellLength As Integer
Dim Counter As Integer
Dim Numbers As String
Dim CheckIt As String

CheckIt = UCase(Cells(1, 1).Value)

CellLength = Len(CheckIt)

For Counter = 1 To CellLength
Numbers = Numbers & Asc(Mid(CheckIt, Counter, 1)) - 64
Next Counter

Cells(1, 2).Value = Numbers

End Sub

--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


Replace @mailinator.com with @tiscali.co.uk


"Varne" wrote in message
...
Hi Mike

Sorry if my information is misleading but I need the codes to generate
numbers to cover every permutation generated via the key board. Actually I
gave the 'abc' as an example. If somebody puts in 'Tim' in cells(1,1) then
the number generated should be 20913 meaning 20 for t, 9 for i and 13 for
m.
Do you have a solution?

Thanks
M Varnendra

"Mike H" wrote:

Hi,

Several ways and here's one

Sub lime()
Select Case Cells(1, 1).Value
Case Is = "abc"
Cells(1, 2) = 123
Case Is = "bac"
Cells(1, 2) = 213
Case Is = "cba"
Cells(1, 2) = 321
Case Else
End Select
End Sub


Mike

"Varne" wrote:

Hi

Could someone show me the codes for the following problem?

I want a Macro that should do the following?

If cells(1,1)="abc" then I want cells(1,2) to show 123
If cells(1,1)="bac" then I want cells(1,2) to show 213
If cells(1,1)="cba" then I want cells(1,2) to show 321

Thanks.

M Varnendra




  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 126
Default Numbers For Letters

Thank You.

M Varnendra

"Sandy Mann" wrote:

Try something like:

Sub NumberIt()
Dim CellLength As Integer
Dim Counter As Integer
Dim Numbers As String
Dim CheckIt As String

CheckIt = UCase(Cells(1, 1).Value)

CellLength = Len(CheckIt)

For Counter = 1 To CellLength
Numbers = Numbers & Asc(Mid(CheckIt, Counter, 1)) - 64
Next Counter

Cells(1, 2).Value = Numbers

End Sub

--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


Replace @mailinator.com with @tiscali.co.uk


"Varne" wrote in message
...
Hi Mike

Sorry if my information is misleading but I need the codes to generate
numbers to cover every permutation generated via the key board. Actually I
gave the 'abc' as an example. If somebody puts in 'Tim' in cells(1,1) then
the number generated should be 20913 meaning 20 for t, 9 for i and 13 for
m.
Do you have a solution?

Thanks
M Varnendra

"Mike H" wrote:

Hi,

Several ways and here's one

Sub lime()
Select Case Cells(1, 1).Value
Case Is = "abc"
Cells(1, 2) = 123
Case Is = "bac"
Cells(1, 2) = 213
Case Is = "cba"
Cells(1, 2) = 321
Case Else
End Select
End Sub


Mike

"Varne" wrote:

Hi

Could someone show me the codes for the following problem?

I want a Macro that should do the following?

If cells(1,1)="abc" then I want cells(1,2) to show 123
If cells(1,1)="bac" then I want cells(1,2) to show 213
If cells(1,1)="cba" then I want cells(1,2) to show 321

Thanks.

M Varnendra







  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,345
Default Numbers For Letters

Youbare very welcome.

--
Regards,

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


Replace @mailinator.com with @tiscali.co.uk


"Varne" wrote in message
...
Thank You.

M Varnendra

"Sandy Mann" wrote:

Try something like:

Sub NumberIt()
Dim CellLength As Integer
Dim Counter As Integer
Dim Numbers As String
Dim CheckIt As String

CheckIt = UCase(Cells(1, 1).Value)

CellLength = Len(CheckIt)

For Counter = 1 To CellLength
Numbers = Numbers & Asc(Mid(CheckIt, Counter, 1)) - 64
Next Counter

Cells(1, 2).Value = Numbers

End Sub

--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


Replace @mailinator.com with @tiscali.co.uk


"Varne" wrote in message
...
Hi Mike

Sorry if my information is misleading but I need the codes to generate
numbers to cover every permutation generated via the key board.
Actually I
gave the 'abc' as an example. If somebody puts in 'Tim' in cells(1,1)
then
the number generated should be 20913 meaning 20 for t, 9 for i and 13
for
m.
Do you have a solution?

Thanks
M Varnendra

"Mike H" wrote:

Hi,

Several ways and here's one

Sub lime()
Select Case Cells(1, 1).Value
Case Is = "abc"
Cells(1, 2) = 123
Case Is = "bac"
Cells(1, 2) = 213
Case Is = "cba"
Cells(1, 2) = 321
Case Else
End Select
End Sub


Mike

"Varne" wrote:

Hi

Could someone show me the codes for the following problem?

I want a Macro that should do the following?

If cells(1,1)="abc" then I want cells(1,2) to show 123
If cells(1,1)="bac" then I want cells(1,2) to show 213
If cells(1,1)="cba" then I want cells(1,2) to show 321

Thanks.

M Varnendra







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
letters for numbers Matthew[_2_] Excel Discussion (Misc queries) 0 November 21st 07 07:10 PM
Sorting - cells containing numbers, numbers and letters Gunny Excel Discussion (Misc queries) 5 July 16th 06 01:22 AM
create self-generating numbers with letters and numbers cxlough41 Excel Discussion (Misc queries) 11 January 4th 06 01:16 AM
Letters = Numbers oberon.black Charts and Charting in Excel 1 November 11th 05 12:52 AM
corresponding numbers and letters laceyMKTSP Excel Discussion (Misc queries) 3 June 21st 05 10:36 PM


All times are GMT +1. The time now is 08:33 PM.

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"