Loops in Excel VBA -- How do I iterate a function through a range? -
So I know that Excel has an NPV function, but I'm trying to create myself because I myself I am trying to teach VBA. I have the data placed in a table and then I want to do it again through a horizontal cells (via G5 via I5). The way I am trying to structure the loop, it is enthusiastically for the number of cash flow and setting that number as the last date. In this way the macro can be used for problems with different periods.
My code is not working and I'm not sure why anyone can see and help me? Please generally use words like I started with VBA yesterday.
Sub NPV () as DIM Y integer, invest in double form, tax double, grille in double form, Double WCP, Double like Dr., I form integer In the form of the double y = range ("C4") inv = range ("C5") = = Range ("C6") = Range ("E4") wc = range ("E5" ) dr = range ("5, 5 + i") v = v / (1 + dr) ^ i total = y = range for i = 1 for totals = 0 as a total ("E6") sum Total + V Next Me Total = Total + ((1 - tax) * Sale) + WC Range ("F5") Value = Total End Sub
Consider taking the place:
v = range ("5, 5 + i") :
v = cell (5, 5 + i)
शुरुआती के लिए दृश्य मूल नमूना कोड
ReplyDeleteबीप्स सैंपल कोड के माध्यम से लूप