A ver, para no estar adivinando o caminando a ciegas por el problema, vamos a ir a lo seguro: 1º: Indicas en la columna B: "Aquí iría la fórmula". Bien, pues te sugiero que introduzcas a mano, en B3:B10 cuáles son los resultados que esperas en cada celda, y expliques cómo y/o por qué se llega a ellos. 2º: Aclara un poco esos significados de 'Factor común 1' y 'Variable por pesos o centavos', para entender cómo juegan en las diferentes resoluciones. 3º: También sería interesante saber cómo interpretar eso de 'ojito al tema porque estos importes entre archivos pueden variar entre el 10% mayor o menor al importe pago'. Para verlo claro, introduce algún ejemplo que fuerce esa diferencia y explica cómo hay que contemplarlo y en qué interfiere para la/s fórmula/s de la columna B. 4º: Y por último, elimina (suprime) todos los datos innecesarios para componer el resultado que buscamos: por ejemplo, ese 'Íd. crédito' de la columna A, ¿aporta algo? ¿No? Pues bórralo. Ídem de lo mismo para 'Nombre' (si no se necesita, bórralo también). Veo que las columnas L y N tienen los mismos contenidos. ¿Por qué no eliminamos una de ellas? Todo lo que sea limpiar la pizarra de garabatos innecesarios, será bienvenido y agradecido. Saludos,
Por
Victor7 , · publicado el 13 de junio 13 jun
Sub FORMATO()
'
' TEXTO_COLUMNAS Macro
'
Sheets("A-S1-001").Select
Range("J2").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.TextToColumns Destination:=Range("J2"), DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 9), Array(10, 1)), TrailingMinusNumbers:=True
Selection.NumberFormat = "h:mm:ss"
Range("K2").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents
Range("K2").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=RC[-1]-R[1]C[-1]"
Range("K2").Select
Selection.Copy
Range("K2:K1001").Select
ActiveSheet.Paste
Selection.End(xlUp).Select
Columns("K:K").Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("K1").Select
Selection.AutoFilter
ActiveSheet.Range("$A$1:$N$1001").AutoFilter Field:=11, Criteria1:= _
"00:00:00"
Range("K1000").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents
Range("K1").Select
ActiveSheet.Range("$A$1:$N$1001").AutoFilter Field:=11
Range("K2").Select
ActiveWorkbook.Worksheets("A-S1-001").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("A-S1-001").Sort.SortFields.Add2 Key:=Range( _
"K2:K1000"), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("A-S1-002").Sort
.SetRange Range("A2:N1000")
.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Selection.End(xlUp).Select
Selection.End(xlToLeft).Select
Sheets("A-S1-002").Select
Range("J2").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.TextToColumns Destination:=Range("J2"), DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 9), Array(10, 1)), TrailingMinusNumbers:=True
Selection.NumberFormat = "h:mm:ss"
Range("K2").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents
Range("K2").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=RC[-1]-R[1]C[-1]"
Range("K2").Select
Selection.Copy
Range("K2:K1001").Select
ActiveSheet.Paste
Selection.End(xlUp).Select
Columns("K:K").Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("K1").Select
Selection.AutoFilter
ActiveSheet.Range("$A$1:$N$1002").AutoFilter Field:=11, Criteria1:= _
"00:00:00"
Range("K1000").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents
Range("K1").Select
ActiveSheet.Range("$A$1:$N$1002").AutoFilter Field:=11
Range("K2").Select
ActiveWorkbook.Worksheets("A-S1-004").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("A-S1-004").Sort.SortFields.Add2 Key:=Range( _
"K2:K1000"), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("A-S1-002").Sort
.SetRange Range("A2:N1000")
.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Selection.End(xlUp).Select
Selection.End(xlToLeft).Select
Sheets("A-S1-003").Select
Range("J2").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.TextToColumns Destination:=Range("J2"), DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 9), Array(10, 1)), TrailingMinusNumbers:=True
Selection.NumberFormat = "h:mm:ss"
Range("K2").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents
Range("K2").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=RC[-1]-R[1]C[-1]"
Range("K2").Select
Selection.Copy
Range("K2:K1001").Select
ActiveSheet.Paste
Selection.End(xlUp).Select
Columns("K:K").Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("K1").Select
Selection.AutoFilter
ActiveSheet.Range("$A$1:$N$1001").AutoFilter Field:=11, Criteria1:= _
"00:00:00"
Range("K1000").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents
Range("K1").Select
ActiveSheet.Range("$A$1:$N$1000").AutoFilter Field:=11
Range("K2").Select
ActiveWorkbook.Worksheets("A-S1-003").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("A-S1-003").Sort.SortFields.Add2 Key:=Range( _
"K2:K1000"), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("A-S1-003").Sort
.SetRange Range("A2:N1000")
.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Selection.End(xlUp).Select
Selection.End(xlToLeft).Select
Módulo3.bas