![]() |
Add text with formated number using VBA
Hello,
Is it possible to add a text with number using vba and format that number to "[$-2000000]#0" Something like Range("A1")= "Sample Text " & format(12345, "[$-2000000]#0") If add 12345 to Range A1 and say Range("A1").numberformat="[$-2000000]#0" then it works properly Thanks |
Add text with formated number using VBA
Format doesn't seem to recognize that format, but this is close:
Sub AAA() s = "This is sample text: " For i = 1 To 5 s = s & ChrW(1776 + i) Next ActiveCell.Value = s ActiveCell.Characters(22, 5).Font.Name = "Lucidia Sans Unicode" End Sub Change Lucidia Sans Unicode to a Unicode font on your system. I don't know the arabic symbols, so this didn't exactly match what the number format produces for the numbers 4 and 5. 1, 2 and 3 seemed to match. Maybe you can see how to correct it. -- Regards, Tom Ogilvy "Abdul" wrote in message oups.com... Hello, Is it possible to add a text with number using vba and format that number to "[$-2000000]#0" Something like Range("A1")= "Sample Text " & format(12345, "[$-2000000]#0") If add 12345 to Range A1 and say Range("A1").numberformat="[$-2000000]#0" then it works properly Thanks |
Add text with formated number using VBA
In Excel 2003 on Windows XP, Arial appears to be unicode, so you don't need
the last line if yours is unicode (there used to be a special Arial Unicode font in Windows 98 and maybe 2000 as I recall): Sub AAA() s = "This is sample text: " For i = 1 To 5 s = s & ChrW(1776 + i) Next ActiveCell.Value = s End Sub -- Regards, Tom Ogilvy "Tom Ogilvy" wrote in message ... Format doesn't seem to recognize that format, but this is close: Sub AAA() s = "This is sample text: " For i = 1 To 5 s = s & ChrW(1776 + i) Next ActiveCell.Value = s ActiveCell.Characters(22, 5).Font.Name = "Lucidia Sans Unicode" End Sub Change Lucidia Sans Unicode to a Unicode font on your system. I don't know the arabic symbols, so this didn't exactly match what the number format produces for the numbers 4 and 5. 1, 2 and 3 seemed to match. Maybe you can see how to correct it. -- Regards, Tom Ogilvy "Abdul" wrote in message oups.com... Hello, Is it possible to add a text with number using vba and format that number to "[$-2000000]#0" Something like Range("A1")= "Sample Text " & format(12345, "[$-2000000]#0") If add 12345 to Range A1 and say Range("A1").numberformat="[$-2000000]#0" then it works properly Thanks |
All times are GMT +1. The time now is 01:31 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com