ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Formatting a Cell or Merged Cells (https://www.excelbanter.com/excel-programming/418630-formatting-cell-merged-cells.html)

DebbieSue

Formatting a Cell or Merged Cells
 
I would like to format a cell to write out an amount of money in another
cell. Like on a Cheque. Example. $6.25 = Six and 25/100. The written portion
would change automatically when the amount changes.

Can someone tell me if formatting exists.

Thank you.

Bobt

Formatting a Cell or Merged Cells
 
There is no built in formatting to do this, however, it's not rocket science
to write it:

Function TextMe(Real_Number As Variant) As String

Dim myString As String

'Thousands
If (Int(Real_Number / 1000) < 0) Then
myString = Int(Real_Number / 1000) & " thousand"
End If

'Get remainder
Real_Number = Real_Number - (Int(Real_Number / 1000) * 1000)

If (Int(Real_Number / 100) < 0) Then
If myString < "" Then
myString = myString & ", "
End If
myString = myString & Int(Real_Number / 100) & " hundred"
End If

'Get remainder
Real_Number = Real_Number - (Int(Real_Number / 100) * 100)

etc.

TextMe = myString

End Function


"DebbieSue" wrote:

I would like to format a cell to write out an amount of money in another
cell. Like on a Cheque. Example. $6.25 = Six and 25/100. The written portion
would change automatically when the amount changes.

Can someone tell me if formatting exists.

Thank you.


DebbieSue

Formatting a Cell or Merged Cells
 
In my case, I would need to be a rocket scientist. I used the function and I
typed in 385.25 and it gave me 3 hundred. That was it. Nothing else. I am
very new to this, so sorry if I'm a pain.

Thank you,
Debbie

"BobT" wrote:

There is no built in formatting to do this, however, it's not rocket science
to write it:

Function TextMe(Real_Number As Variant) As String

Dim myString As String

'Thousands
If (Int(Real_Number / 1000) < 0) Then
myString = Int(Real_Number / 1000) & " thousand"
End If

'Get remainder
Real_Number = Real_Number - (Int(Real_Number / 1000) * 1000)

If (Int(Real_Number / 100) < 0) Then
If myString < "" Then
myString = myString & ", "
End If
myString = myString & Int(Real_Number / 100) & " hundred"
End If

'Get remainder
Real_Number = Real_Number - (Int(Real_Number / 100) * 100)

etc.

TextMe = myString

End Function


"DebbieSue" wrote:

I would like to format a cell to write out an amount of money in another
cell. Like on a Cheque. Example. $6.25 = Six and 25/100. The written portion
would change automatically when the amount changes.

Can someone tell me if formatting exists.

Thank you.


Gord Dibben

Formatting a Cell or Merged Cells
 
Have a look at Bob Phillips' site for several methods.

http://www.xldynamic.com/source/xld.xlFAQ0004.html

If you're not familiar with VBA and macros, see David McRitchie's site for
more on "getting started".

http://www.mvps.org/dmcritchie/excel/getstarted.htm

or Ron de De Bruin's site on where to store macros.

http://www.rondebruin.nl/code.htm


Gord Dibben MS Excel MVP

On Fri, 17 Oct 2008 10:24:00 -0700, DebbieSue
wrote:

In my case, I would need to be a rocket scientist. I used the function and I
typed in 385.25 and it gave me 3 hundred. That was it. Nothing else. I am
very new to this, so sorry if I'm a pain.

Thank you,
Debbie

"BobT" wrote:

There is no built in formatting to do this, however, it's not rocket science
to write it:

Function TextMe(Real_Number As Variant) As String

Dim myString As String

'Thousands
If (Int(Real_Number / 1000) < 0) Then
myString = Int(Real_Number / 1000) & " thousand"
End If

'Get remainder
Real_Number = Real_Number - (Int(Real_Number / 1000) * 1000)

If (Int(Real_Number / 100) < 0) Then
If myString < "" Then
myString = myString & ", "
End If
myString = myString & Int(Real_Number / 100) & " hundred"
End If

'Get remainder
Real_Number = Real_Number - (Int(Real_Number / 100) * 100)

etc.

TextMe = myString

End Function


"DebbieSue" wrote:

I would like to format a cell to write out an amount of money in another
cell. Like on a Cheque. Example. $6.25 = Six and 25/100. The written portion
would change automatically when the amount changes.

Can someone tell me if formatting exists.

Thank you.




All times are GMT +1. The time now is 05:02 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com