Cifras A Texto Excel
abris un exel, vas a herramientas, macro, macros. Donde dice nombre de la macro, pones n1 y despues hacé click en crear.
Te va a abrir un VisualBasic. Justo donde está el cursor, pegá lo siguiente:
Public Function NL(ByVal Numero As Double) As String
Dim NumTmp As String
Dim c01 As Integer
Dim c02 As Integer
Dim pos As Integer
Dim dig AsInteger
Dim cen As Integer
Dim dec As Integer
Dim uni As Integer
Dim letra1 As String
Dim letra2 As String
Dim letra3 As String
Dim Leyenda As String
Dim Leyenda1 As String
Dim TFNumero AsString
If Numero < 0 Then Numero = Abs(Numero)
NumTmp = Format(Numero, "000000000000000.00")
c01 = 1
pos = 1
TFNumero = ""
Do While c01 = 1 And Val(Mid _
(NumTmp, 7, 3)) = 0 Then
Leyenda = "MilMillones "
ElseIf cen + dec + uni >= 1 Then
Leyenda = "Mil "
End If
Case 3
If cen + dec = 0 And uni = 1 Then
Leyenda = "Millon "
ElseIf cen > 0 Or dec > 0 Or uni > 1 Then
Leyenda = "Millones "End If
Case 4
If cen + dec + uni >= 1 Then
Leyenda = "Mil "
End If
Case 5
If cen + dec + uni >= 1 Then
Leyenda = ""
End If
End Select
c01 = c01 + 1
TFNumero = TFNumero + letra3 + letra2 +_
letra1 + Leyenda
Leyenda = ""
letra1 = ""
letra2 = ""
letra3 = ""
Loop
If Val(NumTmp) = 0 Or Val(NumTmp) < 1 Then
Leyenda1 = "Cero Pesos"
ElseIf Val(NumTmp) = 1 Or Val(NumTmp) < 2 ThenLeyenda1 = "Pesos "
ElseIf Val(Mid(NumTmp, 4, 12)) = 0 Or Val(Mid _
(NumTmp, 10, 6)) = 0 Then
Leyenda1 = "de Pesos "
Else
Leyenda1 = "Pesos "
End If
TFNumero = "Son Pesos " & TFNumero & "con " &Mid _
(NumTmp, 17) & "/100"
TFNumero = UCase(TFNumero)
NL = TFNumero
End Function
Private Function Centena(ByVal uni As Integer, _
ByVal dec As Integer, ByVal cen As Integer) As String
SelectCase cen
Case 1
If dec + uni = 0 Then
cTexto = "cien "
Else
cTexto = "ciento "
End If
Case 2: cTexto = "doscientos "
Case 3: cTexto = "trescientos "
Case 4: cTexto = "cuatrocientos "
Case 5:...
Regístrate para leer el documento completo.