كود لتحويل المعادلات الى قيم للاستاذ الفاضل "خبور خير" بارك الله فيه.
Option Explicit
Sub Kh_Formula_To_Value()
Dim MyCalcu As XlCalculation
With Application
MyCalcu = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With
'=====================================
'//////////////////////////////////////
'=====================================
' هنا تضع النطاق والمعادلة التي تريد تحويلها قيم
' Formula_To_Value باستخدام
'=====================================
' T هنا المعادلة اللي في العمود
Formula_To_Value Range("T5:T30"), "=RC[-2]*RC[-1]"
' x هنا المعادلة اللي في العمود
' مثل عمل كود الاخ كيماس
Formula_To_Value Range("X5:X30"), "=IF(COUNTIF(RC16:R30C16,RC16)=1,SUMPRODUCT((R5C16:R1500C16=RC16)*(R5C20:R1500C20)),"""")"
' Y هنا المعادلة اللي في العمود
Formula_To_Value Range("Y5:Y30"), "=SUMPRODUCT((R5C16:R1500C16=RC16)*(R5C20:R1500C20))"
'=====================================
'//////////////////////////////////////
'=====================================
With Application
.ScreenUpdating = True
.Calculation = MyCalcu
End With
End Sub
=================================================
Sub Formula_To_Value(MyRng As Range, MyFormula As Variant)
With MyRng
.ClearContents
.Formula = MyFormula
.Cells = .Value
End With
End Sub
كود تحويل المعادلات الى قيم.rar