![]() |
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 |
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 |
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 |
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 |
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 |
All times are GMT +1. The time now is 04:26 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com