🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: chile.comp.programacion
Article #3690

Duda Visual Basic de Excel

#3690
From: 2004
Date: Mon, 25 Oct 2004 20:36
31 lines
1450 bytes
Hola...ese es mi problema:

quiero hacer esto:

Sub ejemplo()
tasa = 0.15
matriz = Range("c10:i10")
n = Range("c10:i10").Columns.Count
For i = 1 To n
suma = suma + matriz(1, i) / (1 + tasa) ^ i
Next i
Range("a1").Value = suma
End Sub

pero como una funcion, trate lo siguiente pero no me resulto:

Function VAN(tasa, rango)
matriz = Range(rango)
n = Range(rango).Columns.Count
For i = 1 To n
suma = suma + matriz(1, i) / (1 + tasa) ^ i
Next i
suma = tasa + matriz(1, 1)
VAN = suma
End Function

que estoy haciendo mal??? como lo arreglo???

pd: es la funcion para calcular el VAN (se que excel la trae
incorporada, pero la hice solo para probar...para futuras otras
aplicaciones).
Technical Details
Message-ID: <1cea6b8a.0410251236.754e6fec@posting.google.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!postnews1.google.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 1593cb,3d1c2f4e8714c747,start
X-Google-Attributes: gid1593cb,public
X-Google-Language: SPANISH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news1.google.com!postnews1.google.com!not-for-mail
From: juanpacs@gmail.com (2004)
Newsgroups: chile.comp.programacion
Subject: Duda Visual Basic de Excel
Date: 25 Oct 2004 13:36:10 -0700
Organization: http://groups.google.com
Lines: 31
Message-ID: <1cea6b8a.0410251236.754e6fec@posting.google.com>
NNTP-Posting-Host: 200.75.22.2
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: posting.google.com 1098736571 22549 127.0.0.1 (25 Oct 2004 20:36:11 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Mon, 25 Oct 2004 20:36:11 +0000 (UTC)