Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Convert numerics to alpabetics?

I need to fill 19 adjacent cells with the letters B to S
and want to do it programmatically.

I suspect I need a function to generate a String from a Byte.

I've found "Type Conversion Functions",
but it doesn't help much.

Thanks for your help,
Peter.




*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 133
Default Convert numerics to alpabetics?

Try
=CHAR(66)

to CHAR(83)

Just create a loop with the counter increasing. Let me know if you
need help.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Convert numerics to alpabetics?

Put this formula in the first

=CHAR(COLUMN(B1)+64)

and then copy across

--

HTH

RP
(remove nothere from the email address if mailing direct)


"peter" wrote in message
...
I need to fill 19 adjacent cells with the letters B to S
and want to do it programmatically.

I suspect I need a function to generate a String from a Byte.

I've found "Type Conversion Functions",
but it doesn't help much.

Thanks for your help,
Peter.




*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Convert numerics to alpabetics?


Thanks a lot guys, but I've still got some questions.

1. If I'm doing it as an Excel /VBA macro,
why doesn't this work:
s = Application.WorksheetFunction.CHAR(65)
It says, at runtime, the property/method isn't supported.

2. I still can't find this in my books, even the Dummies one.
Why? I can, just, understand why it's not in the indexes
of the non-Microsoft books, but it's not in that one either.
They are all good books too: WROX, O'Reilly and 2 x microsoft.

Thanks again,
Peter.



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Convert numerics to alpabetics?

Not all WS functions are available in VBA, particularly those that have a
similar VBA function (CHAR() vs Chr())

To see all those which are available, open the Excel VBE and open the object
browser (F2). They are listed under ApplicationWorksheetfunction

tim.


"peter" wrote in message
...

Thanks a lot guys, but I've still got some questions.

1. If I'm doing it as an Excel /VBA macro,
why doesn't this work:
s = Application.WorksheetFunction.CHAR(65)
It says, at runtime, the property/method isn't supported.

2. I still can't find this in my books, even the Dummies one.
Why? I can, just, understand why it's not in the indexes
of the non-Microsoft books, but it's not in that one either.
They are all good books too: WROX, O'Reilly and 2 x microsoft.

Thanks again,
Peter.



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default Convert numerics to alpabetics?

On Wed, 23 Feb 2005 13:59:16 -0800, peter wrote:

I need to fill 19 adjacent cells with the letters B to S
and want to do it programmatically.

I suspect I need a function to generate a String from a Byte.


Well, here's one way to do it via VBA:

==================
Sub foo()
Const FirstCol As Long = 3 'Start in Column C
Const Rw As Long = 2 ' Row 2
Dim i As Long, j As Long

j = 66 'Code for B
For i = FirstCol To FirstCol + 17
Cells(Rw, i) = Chr(j)
j = j + 1
Next i

End Sub
=====================


--ron
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Convert numerics to alpabetics?

Hi Peter,

1. If I'm doing it as an Excel /VBA macro,
why doesn't this work:
s = Application.WorksheetFunction.CHAR(65)
It says, at runtime, the property/method isn't supported.


In VBA simply: s =chr(65)

2. I still can't find this in my books, even the Dummies one.
Why? I can, just, understand why it's not in the indexes
of the non-Microsoft books, but it's not in that one either.
They are all good books too: WROX, O'Reilly and 2 x microsoft.


Not all worksheet functions are supported in VBA. See WorksheetFunction in
help for a complete list of those which are.

Why not create a custom list A to Z and use Autofill whenever wou want,
manually or programatically. Just a thought.

Sub AZlist()
Dim v(25)
For i = 0 To 25
v(i) = Chr(65 + i)
Next
Application.AddCustomList v

'' test list
'[b1] = "B"
'[b1].AutoFill [B1:T1]
'[b1].AutoFill [b1:b19]

End Sub

Regards,
Peter T


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 690
Default Convert numerics to alpabetics?

why doesn't this work:
s = Application.WorksheetFunction.CHAR(65)


Vba has it's own function for this, so the CHAR function was not included.

s = Chr(65)

I need to fill 19 adjacent cells with the letters B to S
and want to do it programmatically.


Just a thought. Weeks down the road, reading the code might be a little
hard to follow. One idea might be to use:
(s & e are Start & End)

The reason I mention this is that you will see that "B" is 66, and not 65.
s = Asc("B")
e = Asc("S")

Also, if you run this code, you will see that there are 18 letters, and not
19.

Debug.Print "Number of Letters: " & e - s + 1

Number of Letters: 18

Again, just some ideas. It can get confusing, so I hope I said this right.
:)
--
Dana DeLouis
Win XP & Office 2003


"peter" wrote in message
...
I need to fill 19 adjacent cells with the letters B to S
and want to do it programmatically.



--
Dana DeLouis
Win XP & Office 2003


"peter" wrote in message
...

Thanks a lot guys, but I've still got some questions.

1. If I'm doing it as an Excel /VBA macro,
why doesn't this work:
s = Application.WorksheetFunction.CHAR(65)
It says, at runtime, the property/method isn't supported.

2. I still can't find this in my books, even the Dummies one.
Why? I can, just, understand why it's not in the indexes
of the non-Microsoft books, but it's not in that one either.
They are all good books too: WROX, O'Reilly and 2 x microsoft.

Thanks again,
Peter.



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



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
separation alpha numerics Rod Excel Discussion (Misc queries) 5 January 25th 10 04:18 PM
Extract Numerics only Corey Excel Discussion (Misc queries) 39 January 9th 08 10:16 PM
How to forecast non-numerics? [email protected] Excel Worksheet Functions 4 April 11th 07 03:31 PM
Formula with text and numerics Leslie Isaacs Excel Worksheet Functions 3 November 17th 06 01:02 PM
Making certain a cell contains numerics John Baker Excel Programming 2 November 21st 03 12:57 AM


All times are GMT +1. The time now is 11:46 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"