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.

Insertar fórmula en todos los valores contenidos en las pestañas

publicado

Buenas, quisiera obtener ayuda con un macro para insertar una formula que convierta el valor que tengo en litros a barriles, de la siguiente manera

Hoja original

[TABLE=class: outer_border, width: 100]

[TR]

[TD]Valor original[/TD]

[/TR]

[/TABLE]

Hoja con fórmula insertada

[TABLE=class: outer_border, width: 500]

[TR]

[TD](Valor original/1000)*6,28981[/TD]

[/TR]

[/TABLE]

Esto en todas las pestañas de la hoja de excel, adjunto el documento que necesito cambiar, muchas gracias!

Ejemplo de litros a barriles.xls

Featured Replies

publicado

Hola:

La macro que viene a continuación, hace lo que pides, o eso creo.

Lleva un control de doble ejecución, es decir, si la ejecutas mas de 1 vez, se queja.

Saludos

Sub ConvertirLitrosABarriles()

Dim Hoja As Worksheet, I As Long, F As Long, Celda As Range


For Each Hoja In ActiveWorkbook.Sheets

If Hoja.Range("K1") = "BARRILES" Then
MsgBox Hoja.Name & " Hoja ya convertida. Se ignora."
GoTo Siguiente
End If

For X = 1 To Hoja.Range("A" & Rows.Count).End(xlUp).Row
If Trim(UCase(Hoja.Range("A" & X))) = "NACIONALES" Then I = X
Next

If I = 0 Then
Beep
MsgBox Hoja.Name & "No se donde empezar. Hoja no convertida"
GoTo Siguiente
End If

For X = Hoja.Range("A" & Rows.Count).End(xlUp).Row To 1 Step -1
If Trim(UCase(Hoja.Range("A" & X))) = "TOTALES" Then F = X
Next

If F = 0 Then
Beep
MsgBox Hoja.Name & " No se donde TERMINAR. Hoja no convertida"
GoTo Siguiente
End If

Hoja.Range("K1") = "BARRILES"

For Each Celda In Hoja.Range("B" & I + 1 & ":I" & F - 1)
If Not Celda.HasFormula = True Then
Celda.Value = Celda.Value * 6.28981 / 1000
End If
Next

Siguiente:
Next


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.