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.

Calcular Promedio con rango dinamico

publicado

Hola cracks!! 

Estoy tratando de generar una macro que calcule el promedio de mis datos, pero en vez de que sea un rango fijo de X2:X8431 sea hasta el ultimo valor que tenga la columna X es decir que pueda variar ya que a veces son mas datos o a veces menos, les dejo el código que tengo actualmente con rango fijo.

Range("X2").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(R[2]C:R[8431]C)"

 

He tratado con este pero no funciona:

Dim last_row As Integer

last_row = Cells(Rows.Count, "C").End(xlUp).Row - 1

Range("X2").Select

ActiveCell.FormulaR1C1 = "=AVERAGE(R[2]C:R[last_row]C)"

 

Les agradezco mucho su ayuda si tienen alguna idea se las agradecería muchísimo!

Editado el por Luis Aquino

Featured Replies

publicado

A ver así:

ActiveCell.FormulaR1C1 = "=AVERAGE(R[2]C:R[" & last_row & "]C)"

 

publicado
  • Autor

Correcto!! enorme como siempre Antoni

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.