I am currently removing all live formulas from my Excel sheet and replacing them with a VBA calculation. I have an issue where my fomula from Excel is too long to be used in VBA. I have tried using "union" to split up the fomula but this is not working. It seems this fomula would need to be chanhed to a VBA calculation. Please assist with advice on how to get this to work.
Range("ACA177:BEP188").Value = "=IF(AND(PV_Only_Charge_Batt_T_F=TRUE,OR(Peak_Shaving_Charge_Select=PV_Only_Charge,Peak_Shaving_Charge_Select=PV_OP_Only_Charge),Battery_Function=Battery_Function_Arbitrage,ACA933<>$X$948,ACA933<>$X$954),MIN(MAX(0,ABR806-(ABR834)),Batt_Inv1_QTY*Batt_Inv1_Capacity,(ACA23*(Batt_Inv1_Efficiency/100)),Batt_Inv1_QTY*((Batt_Inv1_DCV*Batt_Inv1_DCA)-Batt_Inv1_0_Load_W)/1000),IF(AND(PV_Only_Charge_Batt_T_F=FALSE,OR(Peak_Shaving_Charge_Select=PV_Only_Charge,Peak_Shaving_Charge_Select=PV_OP_Only_Charge),Battery_Function=Battery_Function_Arbitrage),MIN(MAX(0,ABR806-(ABR834)),Batt_Inv1_QTY*Batt_Inv1_Capacity,(MAX(0,ACA23-ACA89)*(Batt_Inv1_Efficiency/100)),Batt_Inv1_QTY*((Batt_Inv1_DCV*Batt_Inv1_DCA)-Batt_Inv1_0_Load_W)/1000),IF(AND(Battery_Function=Battery_Function_Peak_Shaving,Max_Bat_Charge<ACA23),MIN(((Batt_Nom_V*(Batt_Inv1_QTY*Batt_Inv1_DCA))/1000),(Batt_Total_Cap/1000)-MAX(0,ABR806-(ABR834)),MAX(0,ABR806-(ABR834)),MAX(0,(ACA23-(ACA89-Max_Bat_Charge))*(Batt_Inv1_Efficiency/100)),ACA23,Batt_Inv1_QTY*((Batt_Inv1_DCV*Batt_Inv1_DCA)-Batt_Inv1_0_Load_W)/1000),MIN(Batt_Inv1_QTY*Batt_Inv1_Capacity,ACA23,(Batt_Total_Cap/1000)-MAX(0,ABR806-(ABR834)),MAX(0,ABR806-(ABR834)),MAX(0,(ACA23-ACA89)*(Batt_Inv1_Efficiency/100)),Batt_Inv1_QTY*((Batt_Inv1_DCV*Batt_Inv1_DCA)-Batt_Inv1_0_Load_W)/1000))))"