Saltar al contenido

SUMA DE NUMEROS Y REDUCIRLO A UN SOLO VALOR

publicado

Buen dia:

Tengo la siguiente formula en mi libro =RESIDUO(SUMA(F2:F15)-1;9)+1 pero necesito que 

se ejecute dentro de la macro y no dentro de la celda como se encuentra.

Como seria el codigo...

Atte Gracias

Reducir valor.xlsm

Featured Replies

publicado
Sub AleaIactaEst()
Dim cuant As Integer: cuant = Range("B1")
Dim aleat As Integer
Dim r As Range: Set r = Range("F2:F15")
Dim q, i As Integer
Worksheets(1).Range("F2:H15").ClearContents
'--------------------------------------------------------------------------------------
'Aleatorios
'--------------------------------------------------------------------------------------
q = 0
Do
aleat = Application.WorksheetFunction.RandBetween(Range("B2"), Range("B3"))
q = q + 1: If q > cuant Then Exit Do
    r(q, 1) = aleat
    If q > 1 Then
         For i = 1 To q - 1
            If r(i, 1) = aleat Then
            r(q, 1) = ""
            q = q - 1
                Exit For
            End If
    Next
End If
Loop
'--------------------------------------------------------------------------------------
Range("F2:F15").Sort Key1:=Range("F2:F15"), Order1:=xlAscending
Cells(17, 6) = Application.WorksheetFunction.Sum(ActiveSheet.Range("F2:F15"))
'--------------------------------------------------------------------------------------

Range("F18").Formula = "=MOD(SUM(F2:F15)-1,9)+1"
Range("F18").Value = Range("F18").Value 'Boorar esta linea si quieres que se vea la formula.
Exit Sub
End Sub

Hola, prueba con el código añadido.

publicado
  • Autor

Buen dia César Rolando, el código funciono bien...

Agradecido por tu ayuda.

Gracias....

Archivado

Este tema está ahora archivado y está cerrado a más respuestas.