Hi,
I am new to Excel VBA abd have been stuck in this problem for quite some time now. I am required to
This is the excel file from which I'm taking the different inputs.
Excel 2010
<colgroup><col style="px"width:" 25pxpx"=""><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
My code on Vba till now i worked on looks like this
The following is the excel file from where I am deriving the inputs for different test cases.
Excel 2010
<colgroup><col style="px"width:" 25pxpx"=""><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
<tbody>
</tbody>
<tbody>
</tbody>
I am new to Excel VBA abd have been stuck in this problem for quite some time now. I am required to
read
number of test cases with
number of inputs and display the outputs through a button macro in developer ribbon. I'm looking to write a function to accomplish this and any help that I can get in order to complete the task would be greatly appreciated. I want a function so that my code runs for different tyes of inputs and stays generic. Thank you very much.
This is the excel file from which I'm taking the different inputs.
Excel 2010
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | AA | AB | AC | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Test Cases | input_BirthDate | input_HireDate | input_Gender | input_AnnualPlanComp | input_EmployeeClass | input_AnnualPayGrowth | input_MarketPerformance | input_PVD | input_NRA | input_MBAA | input_Custom_BCD | input_Custom_TermAge | input_RemainingElections | input_Pre2011ServiceYears | input_ProjectedServiceYears | input_ProjectedBenefitAmount | input_DROP_LumpSum | input_ProjBuyBackABO | input_DateABO | input_ProjectedABO | input_ProjectedAAL | input_DateAAL | input_InvestmentBalanceTBA | input_CurrentABO | ||||
2 | 1 | 6/5/1954 | 8/1/2013 | F | 50224 | Regular School District | 1 | Average | 70 | 62 | 65 | 64 | 64 | 1 | 4 | 11 | 7028.58 | 0 | 2/28/2018 | 103461.5 | 48696 | 3/31/2018 | 0 | 80772.6 | |||||
3 | 2 | 1/4/1983 | 10/1/2012 | F | 36179.33 | Regular School District | 1 | Average | 38 | 63 | 66 | 35 | 90 | 1 | 0 | 6.33 | 0 | 4461.18 | 0 | 1/31/2018 | 4461.18 | 0 | 1/1/1900 | 0 | 3340.03 |
<colgroup><col style="px"width:" 25pxpx"=""><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
ip
My code on Vba till now i worked on looks like this
Code:
Sub xp()
Dim http As Object
Dim st As String
Set http = CreateObject("MSXML2.XMLHTTP")
st = "Site=SBA_Modeler_V22&Data={'input_BirthDate':'1983-01-04','input_HireDate':'2012-10-01','input_Gender':'F','input_AnnualPlanComp':36179.33,'input_EmployeeClass':'Regular School District','input_AnnualPayGrowth':1,'input_MarketPerformance':'Average','input_PVD':38,'input_NRA':63,'input_MBAA':66,'input_Custom_BCD':35,'input_Custom_TermAge':90,'input_RemainingElections':1,'input_Pre2011ServiceYears':0,'input_ProjectedServiceYears':6.33,'input_ProjectedBenefitAmount':0,'input_DROP_LumpSum':4461.18,'input_ProjBuyBackABO':0,'input_DateABO':2018-01-31,'input_ProjectedABO':4461.18,'input_ProjectedAAL':0,'input_DateAAL':1900-01-01,'input_InvestmentBalanceTBA':0,'input_CurrentABO':3340.03}"
http.Open "POST", "https://beqlb02.poolt.hewitt.com/dsi0042/calculator", False
http.setRequestHeader "Content-type", "application/x-www-form-urlencoded"
http.send (st)
MsgBox (http.responsetext)
Set JSON = ParseJson("[" + http.responsetext + "]")
i = 1
For Each Item In JSON
Sheets(4).Cells(3, 2).Value = JSON(1).Item("output_Range_Age1")
Sheets(4).Cells(3, 3).Value = JSON(1).Item("output_Range_Age2")
Sheets(4).Cells(3, 4).Value = JSON(1).Item("output_Range_Age3")
Sheets(4).Cells(3, 5).Value = JSON(1).Item("output_Range_Age4")
Sheets(4).Cells(3, 6).Value = JSON(1).Item("output_Range_Age5")
Sheets(4).Cells(3, 7).Value = JSON(1).Item("output_Range_Custom")
Sheets(4).Cells(3, 8).Value = JSON(1).Item("output_Balance_Age1")
Sheets(4).Cells(3, 9).Value = JSON(1).Item("output_Balance_Age2")
Sheets(4).Cells(3, 10).Value = JSON(1).Item("output_Balance_Age3")
Sheets(4).Cells(3, 11).Value = JSON(1).Item("output_Balance_Age4")
Sheets(4).Cells(3, 12).Value = JSON(1).Item("output_Balance_Age5")
Sheets(4).Cells(3, 13).Value = JSON(1).Item("output_Balance_Custom")
Sheets(4).Cells(3, 14).Value = JSON(1).Item("output_Balance_LumpSum")
Sheets(4).Cells(3, 16).Value = JSON(1).Item("output_CurrentAge")
Sheets(4).Cells(3, 17).Value = JSON(1).Item("output_MinAgeTerm")
Sheets(4).Cells(3, 18).Value = JSON(1).Item("output_MaxAgeTerm")
Sheets(4).Cells(3, 19).Value = JSON(1).Item("output_MinAgeBCD")
Sheets(4).Cells(3, 20).Value = JSON(1).Item("output_MaxAgeBCD")
Sheets(4).Cells(3, 22).Value = JSON(1).Item("output_DROP_Question")
Sheets(4).Cells(3, 23).Value = JSON(1).Item("output_DROP_Years")
Sheets(4).Cells(3, 24).Value = JSON(1).Item("output_DROP_Start")
Sheets(4).Cells(3, 25).Value = JSON(1).Item("output_DROP_1stYear")
Sheets(4).Cells(3, 26).Value = JSON(1).Item("output_DROP_Acumulation")
Sheets(4).Cells(3, 27).Value = JSON(1).Item("output_DROP_AccumulationAnnuity")
Sheets(4).Cells(3, 28).Value = JSON(1).Item("output_DROP_TotalAnnuity")
Sheets(4).Cells(3, 29).Value = JSON(1).Item("output_DROP_COLA")
Sheets(4).Cells(3, 31).Value = JSON(1).Item("output_BuyBack_Payment")
Sheets(4).Cells(3, 32).Value = JSON(1).Item("output_BuyBack_IP_AddOn")
Sheets(4).Cells(3, 33).Value = JSON(1).Item("output_DROP_BuyBack_TotalAnnuity")
i = i + 1
Next
MsgBox ("complete")
End Sub
The following is the excel file from where I am deriving the inputs for different test cases.
Excel 2010
C | D | E | F | G | |
---|---|---|---|---|---|
2 | input_BirthDate | 6/5/1954 | output_Range_Age1 | 70 | |
3 | input_HireDate | 8/1/2013 | output_Range_Age2 | ||
4 | input_Gender | F | output_Range_Age3 | ||
5 | input_AnnualPlanComp | 50224 | output_Range_Age4 | ||
6 | input_EmployeeClass | Regular School District | output_Range_Age5 | ||
7 | input_AnnualPayGrowth | 1 | output_Range_Custom | 64 | |
8 | input_MarketPerformance | Average | output_Balance_Age1 | $ - | |
9 | output_Balance_Age2 | $ - | |||
10 | input_PVD | 70 | output_Balance_Age3 | $ - | |
11 | input_NRA | 62 | output_Balance_Age4 | $ - | |
12 | input_MBAA | 65 | output_Balance_Age5 | $ - | |
13 | input_Custom_BCD | 64 | output_Balance_Custom | $ - | |
14 | input_Custom_TermAge | 64 | output_Balance_LumpSum | $ - | |
15 | |||||
16 | input_RemainingElections | 1 | output_CurrentAge | 63 | |
17 | output_MinAgeTerm | 64 | |||
18 | input_Pre2011ServiceYears | 4 | output_MaxAgeTerm | 80 | |
19 | input_ProjectedServiceYears | 11 | output_MinAgeBCD | 70 | |
20 | input_ProjectedBenefitAmount | 7028.58 | output_MaxAgeBCD | 65 | |
21 | input_DROP_LumpSum | 0 | |||
22 | output_DROP_Question | FALSE | |||
23 | input_ProjBuyBackABO | output_DROP_Years | |||
24 | input_DateABO | 2/28/2018 | output_DROP_Start | ||
25 | input_ProjectedABO | 103461.51 | output_DROP_1stYear | ||
26 | input_ProjectedAAL | 48696 | output_DROP_Accumulation | ||
27 | input_DateAAL | 3/31/2018 | output_DROP_AccumulationAnnuity | ||
28 | input_InvestmentBalanceTBA | 0 | output_DROP_TotalAnnuity | ||
29 | input_CurrentABO | 80772.6 | output_DROP_COLA | 1.09% | |
30 | |||||
31 | output_BuyBack_PP | $ 48,696.00 | |||
32 | output_BuyBack_Payment | $ 48,696.00 | |||
33 | output_BuyBack_IP_AddOn | $ 2,627.08 | |||
34 | output_BuyBack_TotalAnnuity | $ 2,627.08 |
<colgroup><col style="px"width:" 25pxpx"=""><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Inputs Outputs
Worksheet Formulas
<thead> </thead><tbody> </tbody> |
<tbody>
</tbody>
Workbook Defined Names
<thead> </thead><tbody> </tbody> |
<tbody>
</tbody>