اذهب الي المحتوي
أوفيسنا

الردود الموصى بها

  • أفضل إجابة
قام بنشر
Sub Test()
    Const iNum As Double = 50
    Dim a, t As Double, i As Long, k As Long
    Application.ScreenUpdating = False
        With ActiveSheet
            a = .Range("A4:A" & .Cells(Rows.Count, 1).End(xlUp).Row).Value
            ReDim b(1 To UBound(a, 1) * 10, 1 To 1)
            For i = LBound(a) To UBound(a)
                k = k + 1
                If a(i, 1) <= iNum Then
                    b(k, 1) = a(i, 1)
                ElseIf a(i, 1) > iNum Then
                    t = a(i, 1)
                    Do
                        b(k, 1) = IIf(t >= iNum, iNum, t)
                        t = t - iNum
                        k = k + 1
                        If t <= iNum Then b(k, 1) = t: Exit Do
                    Loop Until t < iNum
                End If
            Next i
            .Range("E10").Resize(k, UBound(b, 2)).Value = b
        End With
    Application.ScreenUpdating = True
End Sub

 

  • Like 3
  • Thanks 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

زائر
اضف رد علي هذا الموضوع....

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • تصفح هذا الموضوع مؤخراً   0 اعضاء متواجدين الان

    • لايوجد اعضاء مسجلون يتصفحون هذه الصفحه
×
×
  • اضف...

Important Information