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.

Macro que agregue datos a la izquierda de una celda según la condición dada

publicado

Hola

Estoy intentado crear un macro que me agregue "(57)" si la celda cumple una condición o "(57)()" si cumple otra.

Es decir tengo en la columna U los siguientes datos

U2      (4)1234567

U3      (1)2345878

U4      ________ vacia

U5      1234567

U6       2345678

Entonces necesitaría que al ejecutar el macro me lea todos los datos de la Columna U y me los cambie así:

U2      (57)(4)1234567

U3      (57)(1)2345878

U4      ________ vacia

U5       (57)()1234567

U6       (57)()2345678

 

Muchas gracias, estaré atenta a sus respuestas.

 

Featured Replies

publicado
Sub Poner57()
   Aplication.ScreenUpdating = False
   For x = 2 To Range("U" & Rows.Count).End(xlUp).Row
      If Not Left(Range("U" & x), 5) = "(57)(" Then
         If Left(Range("U" & x), 1) = "(" Then
            Range("U" & x) = "(57)" & Range("U" & x)
         Else
            Range("U" & x) = "(57)()" & Range("U" & x)
         End If
      End If
   Next
End Sub

 

publicado
  • Autor

Hola

El macro funciona pero si la celda U2 esta vacía no debería escribirme nada y me pone (57)() .

 

Gracias

publicado
Sub Poner57()
   Aplication.ScreenUpdating = False
   For x = 2 To Range("U" & Rows.Count).End(xlUp).Row
      If Not Left(Range("U" & x), 5) = "(57)("  And _
         Len(Trim(Range("U" & x))) > 0 Then
         If Left(Range("U" & x), 1) = "(" Then
            Range("U" & x) = "(57)" & Range("U" & x)
         Else
            Range("U" & x) = "(57)()" & Range("U" & x)
         End If
      End If
   Next
End Sub

 

  • 2 weeks later...
  • Silvia bloqueó este tema

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.