andreascostas
Board Regular
- Joined
- Jan 11, 2011
- Messages
- 150
OK. I have two UDF functions both named the same thing: :Decompose", each one decomposes a number
but in different format. Now i need to use both functions in the same worksheet, but excel won't let me do that.
How do I go about doing that.
Here are the functions:
Function Decompose(ByVal Number As String) As String
Dim X As Long
Number = Replace(Number, ",", "")
If Number = 0 Then
Decompose = "0 ones"
Else
For X = Len(Number) To 1 Step -1
If Mid(Number, X, 1) Then Decompose = Mid(Number, X, 1) & Choose(Len(Number) - X + 1, " ones", " tens", " hundreds", " thousands", " ten thousands", " hundreds thousands") & " + " & Decompose
Next
Decompose = Left(Decompose, Len(Decompose) - 3)
End If
End Function
second function
Function Decompose(ByVal Number As String) As String
Dim X As Long
Number = Replace(Number, ",", "")
If Number = 0 Then
Decompose = "0 ones"
Else
For X = Len(Number) To 1 Step -1
If Mid(Number, X, 1) Then Decompose = Mid(Number, X, 1) & Choose(Len(Number) - X + 1, " x 1)", " x 10)", " x 100)", " x 1,000)", " x 10,000)", " x 100,000)") & " + " & Decompose
Next
Decompose = Left(Decompose, Len(Decompose) - 3)
End If
End Function
but in different format. Now i need to use both functions in the same worksheet, but excel won't let me do that.
How do I go about doing that.
Here are the functions:
Function Decompose(ByVal Number As String) As String
Dim X As Long
Number = Replace(Number, ",", "")
If Number = 0 Then
Decompose = "0 ones"
Else
For X = Len(Number) To 1 Step -1
If Mid(Number, X, 1) Then Decompose = Mid(Number, X, 1) & Choose(Len(Number) - X + 1, " ones", " tens", " hundreds", " thousands", " ten thousands", " hundreds thousands") & " + " & Decompose
Next
Decompose = Left(Decompose, Len(Decompose) - 3)
End If
End Function
second function
Function Decompose(ByVal Number As String) As String
Dim X As Long
Number = Replace(Number, ",", "")
If Number = 0 Then
Decompose = "0 ones"
Else
For X = Len(Number) To 1 Step -1
If Mid(Number, X, 1) Then Decompose = Mid(Number, X, 1) & Choose(Len(Number) - X + 1, " x 1)", " x 10)", " x 100)", " x 1,000)", " x 10,000)", " x 100,000)") & " + " & Decompose
Next
Decompose = Left(Decompose, Len(Decompose) - 3)
End If
End Function