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.
publicado

Hola,

 

Estoy tratando de hacer una macro incremental para cada columna de semana.

La columna A son los codigos unicos y por cada codigo hay dos datos de sales y fcst

 

conn la siguiente condicional:

1.    Si no tenemos Sales pero sí Fcst se pone ambos en rojo > Si en la celda de Sales = 0 y Fcst si tiene dato > Rojo
2.    Si tenemos Sales pero está por debajo de Fcst se pone ambos en naranja  > Si en la celda de Sales> celda Fcst > Naranja
3.    Si tenemos Sales y es la misma cantidad que el Fcst se pone ambos en verde
4.    Si tenemos Sales y el Fcst es inferior a este o es 0 se pone ambos en morado.
 

Gracias.

cond. excel.xlsx

Featured Replies

publicado

Prueba esta macro, vale para cualquier cantidad de filas/columnas.

Const Naranja As Long = 6403322
Const Morado As Long = 11423218
Const Verde As Long = 4896057
Const Rojo As Long = 6709491
'--
Sub Resaltes()
Dim Sales As Range, Fcst As Range
Application.ScreenUpdating = False
'--
For x = 2 To Range("A" & Rows.Count).End(xlUp).Row Step 2
   For y = 4 To Cells(1, Columns.Count).End(xlToLeft).Column
      '--
      Set Fcst = Cells(x, y)
      Set Sales = Cells(x, y).Offset(1)
      '--
      Sales.Interior.ColorIndex = xlNone
      Fcst.Interior.ColorIndex = xlNone
      '--
      If Sales <> "" Then
         If Round(Sales) = 0 And Round(Fcst) > 0 Then
            Sales.Interior.Color = Rojo
            Fcst.Interior.Color = Rojo
         End If
         '--
         If Round(Sales) <> 0 And Round(Sales) < Round(Fcst) Then
            Sales.Interior.Color = Naranja
            Fcst.Interior.Color = Naranja
         End If
         '--
         If Round(Sales) = Round(Fcst) Then
            Sales.Interior.Color = Verde
            Fcst.Interior.Color = Verde
         End If
         '--
         If Round(Sales) <> 0 And Round(Fcst) < Round(Sales) Then
            Sales.Interior.Color = Morado
            Fcst.Interior.Color = Morado
         End If
         '--
      End If
   Next
Next
End Sub

 

Crear una cuenta o conéctate para comentar

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.