Macros help [Solved/Closed]

Report
-
 suryam -
Dear Friend


i want to convert number to text in excel programme


Example : ( 055555 : Zero five Five Five Five Five ) As This Format


Thanks Dilip

4 replies

Posts
1862
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
July 30, 2015
791
park this in N1 to O10

0 zero
1 one
2 two
3 three
4 four
5 five
6 six
7 seveb
8 eight
9 nine

enter 055555 in A1
your 055555 should be entered as single apostrophe(') and this 055555 otherwise it will be entered as 55555

then run this macro and see B1


Sub test()
Dim r As Range
Dim x As String, j As Integer, y As String, cfind As Range
Set r = Range("A1")
j = 1
y = ""
Do

x = Mid(r, j, 1)
Set cfind = Range("N1:N10").Cells.Find(what:=x, lookat:=xlWhole)
y = y & cfind.Offset(0, 1)
j = j + 1
If j > Len(r) Then Exit Do
Loop
'MsgBox y
r.Offset(0, 1) = y
End Sub
2
Thank you

A few words of thanks would be greatly appreciated. Add comment

CCM 2942 users have said thank you to us this month

hi
this is interesting.....but when I used it in the excel 2007 , it is giving a runtime error "91" . It says that object was not created for the variable " y " to refer...can u pls sort it out? thanks suryam
Posts
1862
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
July 30, 2015
791
It works for me in excel 2007.

I wonder what could be the mistake

have you correctly copied in columns N and O from row 1 down

have you correctly entered '055555 (that is with an apostrophe in the beginning)
you can see it in my file.
download the file "suryam.xlsm" from this url

http://www.speedyshare.com/files/28301356/suryam.xlsm

see B1 (the macro is embedded in vb editor). this file is excel 2007 macro enabled workbook.
Hi venkat, you are simply superb..great and intelligent work indeed.
I appreciate your knowledge . really. thanks again for your help...bye suryam