Part A. Introduction To Excel and VBA: Computer Lab #1
Part A. Introduction To Excel and VBA: Computer Lab #1
Part A. Introduction To Excel and VBA: Computer Lab #1
Computer Lab #1
Note 1: if you type this formula into cell G5, you can copy and paste into G5:H8:
=$C5*G$4+$D5*G$4^2/2+$E5*G$4^3/3+$F5*G$4^4/4
Note 2: if you change the position of $ in above formula and copy/paste, what will happen?
For i = 1 To 4
ent(i) = a(i) * T + b(i) * T ^ 2 / 2 + c(i) * T ^ 3 / 3 + d(i) * T ^ 4 / 4
Next i
enthalpy= ent(1) * xCO2 + ent(2) * xH2O + ent(3) * xO2 + ent(4) * xN2
End Function
Where: T is the temperature, xCO2, xH2O, xO2, xN2 are moles of CO2, H2O, O2 and N2,
respectively.
Check your code in Excel spreadsheet by comparing to your answer in Question A1.
Question B2
Write a VBA code to calculate T2 so that:
enthalpy(T2, xCO2, xH2O, xO2, xN2) - enthalpy(25, xCO2, xH2O, xO2, xN2) = 826.957 kJ
CHE212- Process Engineering and Analysis 2016
end if
Next i
BisectionX = Mi
End Function
Question B3
Fill out the spreadsheet B3 using your macro. Plot x versus T