Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 137
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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





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
Cell that is formated for Date shows a diffrent number Haider Excel Discussion (Misc queries) 2 December 8th 09 08:26 PM
If Statement - With Formated text Larry L Excel Worksheet Functions 1 June 16th 06 03:00 PM
need to force PT to use formated number David Russell Excel Worksheet Functions 2 March 15th 05 11:37 PM
How do I convert a number formated as a date to text in Excel? BrotherNov Excel Discussion (Misc queries) 5 March 2nd 05 03:51 PM
Copying Formated Text Brad Young Excel Programming 0 September 7th 04 05:08 AM


All times are GMT +1. The time now is 04:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"