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.

Como hacer una macro que utilize datos de la hoja anterior

publicado

Hola buenos dias, se que debe ser algo super básico pero estoy recién involucrandome con macros. Necesito construir una macro que cambie los datos de un gráfico por los de la hoja anterior, pero que ésta pueda ser utilizada en cualquier hoja, es decir, si la activo en la hoja 3 que saque datos de la 2 pero si lo hago en la hoja 7 que lo haga de la 6.

por ejemplo :

    ActiveSheet.ChartObjects("3 Gráfico").Activate
ActiveChart.PlotArea.Select
ActiveChart.SeriesCollection(3).Values = "=hoja1!$D$16:$AH$16"
ActiveSheet.ChartObjects("4 Gráfico").Activate
ActiveChart.PlotArea.Select
ActiveChart.SeriesCollection(3).Values = "=hoja1!$D$30:$AE$30"[/PHP]

lo único que necesito es que en vez de modificar el gráfico con los datos de la hoja 1 lo haga con los de la anterior. Muchas gracias.

Featured Replies

publicado

Hola:

Sustituya su código por:



[I][B][COLOR=#0000cd]If ActiveSheet.Index > 1 Then[/COLOR]
[/B][/I]
ActiveSheet.ChartObjects("3 Gráfico").Activate
ActiveChart.PlotArea.Select
ActiveChart.SeriesCollection(3).Values = _
"=" & [COLOR=#0000cd][I][B]Sheets(ActiveSheet.Index - 1).Name[/B][/I][/COLOR] & "!$D$16:$AH$16"
ActiveSheet.ChartObjects("4 Gráfico").Activate
ActiveChart.PlotArea.Select
ActiveChart.SeriesCollection(3).Values = _
"=" & [COLOR=#0000cd][I][B]Sheets(ActiveSheet.Index - 1).Name[/B][/I][/COLOR] & "!$D$30:$AE$30"

[COLOR=#0000cd][I][B]End If[/B][/I][/COLOR]


[/CODE]

Saludos

publicado
  • Autor

Muchas graciaas! funcionó de maravilla y agradezco su rápida respuesta. Le debo una ya que eran muchooos gráficos.

Saludos

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.