I need to convert a standard dollar amount (eg 157.62) to a 9-digit
number without decimals or rounding (eg 000015762). The formulas I've
tried so far a
For Each rw In ActiveSheet.UsedRange.Rows
If Application.CountIf(rw, quot;*monetary*quot;) gt; 0 Then
With rw
.NumberFormat = quot;0000000.00;(0000000.00)quot;
End With
End If
Next
Which formats as quot;0000157.62quot;. And:
For Each rw In ActiveSheet.UsedRange.Rows
If Application.CountIf(rw, quot;*monetary*quot;) gt; 0 Then
With rw
.NumberFormat = quot;000000000;(000000000)quot;
End With
End If
Next
Which formats as quot;000000158quot;.
Does such a thing exist? Any assistance would be greatly appreciated.
Thanks in advance.=TEXT(A1*100,quot;000000000quot;)--
Regards,
Davequot; wrote:
gt; I need to convert a standard dollar amount (eg 157.62) to a 9-digit
gt; number without decimals or rounding (eg 000015762). The formulas I've
gt; tried so far a
gt;
gt; For Each rw In ActiveSheet.UsedRange.Rows
gt; If Application.CountIf(rw, quot;*monetary*quot;) gt; 0 Then
gt; With rw
gt; .NumberFormat = quot;0000000.00;(0000000.00)quot;
gt; End With
gt; End If
gt; Next
gt;
gt; Which formats as quot;0000157.62quot;. And:
gt;
gt; For Each rw In ActiveSheet.UsedRange.Rows
gt; If Application.CountIf(rw, quot;*monetary*quot;) gt; 0 Then
gt; With rw
gt; .NumberFormat = quot;000000000;(000000000)quot;
gt; End With
gt; End If
gt; Next
gt;
gt; Which formats as quot;000000158quot;.
gt;
gt; Does such a thing exist? Any assistance would be greatly appreciated.
gt; Thanks in advance.
gt;
gt;
Thanks for the quick response. When I tested your suggestion, I
received a quot;Compile Error: Sub or Function not definedquot;. This is the
code as I have it:
For Each rw In ActiveSheet.UsedRange.Rows
If Application.CountIf(rw, quot;*monetary*quot;) gt; 0 Then
With rw
.NumberFormat = Text(A1 * 100, quot;000000000quot;)
End With
End If
Next
I'm definitely a novice, so I'm not sure where to begin
troubleshooting. Thanks again for your help.Heh, no that is an excel built in function, just place that formula in any
cell within the spreadsheet (not in a macro), and change the reference of A1
to the cell you wish to change. Sorry for not specifying :-)
--
Regards,
Davequot; wrote:
gt; Thanks for the quick response. When I tested your suggestion, I
gt; received a quot;Compile Error: Sub or Function not definedquot;. This is the
gt; code as I have it:
gt;
gt; For Each rw In ActiveSheet.UsedRange.Rows
gt; If Application.CountIf(rw, quot;*monetary*quot;) gt; 0 Then
gt; With rw
gt; .NumberFormat = Text(A1 * 100, quot;000000000quot;)
gt; End With
gt; End If
gt; Next
gt;
gt; I'm definitely a novice, so I'm not sure where to begin
gt; troubleshooting. Thanks again for your help.
gt;
gt;
I guess that shows how much of a novice I truly am. The problem is
that this macro is used on a spreadsheet which imports data from a CSV
file on a weekly basis. I also need to have this formula applied
conditionally to cells with the quot;monetaryquot; data only. Because of this,
the only viable option I've found is to do it through a macro. Is
there a way to apply the formula you've given to variable row based on
the date of a specific cell?
- Dec 18 Mon 2006 20:10
Format monetary amount to 9 digits with No decimals without rounding
close
全站熱搜
留言列表
發表留言