Ver Mensaje Individual
  #3 (permalink)  
Antiguo 30/11/2013, 15:44
Avatar de mrocf
mrocf
 
Fecha de Ingreso: marzo-2007
Ubicación: Bs.As.
Mensajes: 1.103
Antigüedad: 17 años
Puntos: 88
Respuesta: Macro para copiar celdas con condición

Hola! Cocko (y Perr0)
Al no subir tu archivo de muestra, hay que estar adivinando -aproximadamente- un 68,32% de la información que se requiere para ayudarte.

Aún así, y si te esmeras depurando el código que te voy a mostrar, creo que podrás resolver tu problema:

Código PHP:
Sub a_Lista_de_Compras()
Dim Q&
Application.ScreenUpdating False
With Sheets
("Lista de compras")
  
WorksheetFunction.Max(7, .Cells(.Rows.Count"a").End(xlShiftUp).Row)
  .
Range("a6""c" Q).Delete xlShiftUp
End With
With ActiveSheet
  Q 
WorksheetFunction.Max(8, .Cells(.Rows.Count"a").End(xlUp).Row) - 6
  Workbooks
.Add xlWBATWorksheet
  
[a1:e1].Resize(Q) = .[a7:e7].Resize(Q).Value
  
[c1].Resize(Q).Insert xlShiftToRight
  
[c1] = "Cantidad"
  
[h2] = "=D2<=E2"
  
With [c2].Resize(1)
    .
Formula "=f2 - d2"
    
.Value = .Value
  End With
  Range
("a1:e" Q).AdvancedFilter 2, [h1:h2], [j1], False
  With 
.Parent.Sheets("Lista de compras")
    If [
j2] <> "" Then [j1].CurrentRegion.Resize(, 3).Copy .[a6]
    
ActiveWorkbook.Close False
    Application
.Goto .[a6]
  
End With
End With
Application
.ScreenUpdating True
End Sub 
Saludos, Cacho R.