When I try to run the VBA functions that are listed below I get a Compile Error:
ID: 1825146 • Letter: W
Question
When I try to run the VBA functions that are listed below I get a Compile Error: Duplicate Declaration in Current Scope. Any help that I could get to figure this out would be greatly appreciated. Thank you. Option Explicit Function Eulermultiple(dt, ti, tf, C0 As Variant) Dim h As Double, t As Double, C(1) As Double, C(2) As Double, Cprime() As Double t = ti h = dt C(0) = C0(1) C(1) = C0(2) C(2) = CO(3) Do If t + dt > tf Then h = tf - t End If Cprime = dydt(C) C(0) = C(0) + h * Cprime(0) C(1) = C(1) + h * Cprime(1) C(2) = C(2) + h * Cprime(2) t = t + h If t >= tf Then Exit Do Loop Eulermultiple = C End Function Function dydt(C() As Double) As Variant Dim Cprime(1) As Double Cprime(0) = -1 * C(0) Cprime(1) = 1 * C(0) - 0.5 * C(1) Cprime(2) = 0.5 * C(1) dydt = Cprime End FunctionExplanation / Answer
expected' but i don't know the reason, the functions simply take some values an store them in an here is the Dim productos(19, 3) As String Sub agregarProducto(ByVal descripcion As String, ByVal modelo As String, _ ByVal precio As String, ByVal unidad As String) Dim r As Integer For r = 0 To 19 If productos(r, 0) = "" Then productos(r, 0) = descripcion productos(r, 1) = modelo productos(r, 2) = precio productos(r, 3) = unidad End If Next End Sub Sub agregarProductoTelas() Dim descripcion, modelo, precio, unidad As String If Selection.Column = 1 Then descripcion = Selection. Offset(0, 0).Value modelo = Selection.Offset(0, 0).Value precio = Selection.Offset(0, 3).Value unidad = Selection.Offset(0, 2).Value agregarProducto(descripcion, modelo, precio, unidad) 'error happens right here MsgBox (descripcion)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.