Saltar al contenido
View in the app

A better way to browse. Learn more.

Ayuda Excel

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Sub o function no definido

publicado

Soy principiante y mi idea es realizar una hoja de cálculo con un botón que al darle click, actualice dos celdas en función de otras dos casillas.

El código que escribí al botón es el siguiente:

Dim h As Double

Dim v As Double

Dim t As Double

Dim f As Double

Private Sub CommandButton1_Click()

h = Cell(5, 4).Value

v = Cell(6, 4).Value

t = 10 ^ (-0.95 * Log(v) + 0.0207 * h - 0.087)

f = 1 / (2 * Pi() * t)

Cell(7, 4).Value = t

Cell(8, 4).Value = f

End Sub

Al compilar subraya la línea Private Sub CommandButton1_Click() y dice Error de compilación: Sub o Function no definido.

Muchas por su ayuda de antemano

Featured Replies

publicado
  • Autor

Este es el archivo con la programación. Saludos y muchas gracias por la ayuda.

intento.xls

publicado

.

No has definido la función Pi(), dando por supuesto que lo que pretendes es obtener el nº PI, he sustituido tu función por Application.WorksheetFunction.Pi.

Private Sub CommandButton2_Click()
v = TextBox1.Value
h = TextBox2.Value
t = 10 ^ (-0.95464903 * Log(v) + 0.02078474 * h + -0.08728331)
TextBox3.Value = t
f = 1 / (2 * Application.WorksheetFunction.Pi * t)
TextBox4.Value = f
End Sub
[/CODE]

.

Archivado

Este tema está ahora archivado y está cerrado a más respuestas.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.