Veja se é isto, só ajuste a coluna que tem a condição se não for a "J" com o termo "OK".
Sub JogarMauro()
Dim WJog As Worksheet
Dim WJRep As Worksheet
Dim Resp As String
Dim sContagem As Double
Application.ScreenUpdating = False
Set WJog = Sheets("Jogos")
WJog.Range("B2").Value = ""
Set WJRep = Sheets("Jogos a Repetir")
WJRep.Select
WJRep.Range("A2:G2").Select
WJRep.Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents
WJRep.Range("A2").Select
WJog.Select
WJog.Range("A11").Select
Do While ActiveCell <> ""
If ActiveCell.Offset(0, 9).Value = "OK" Then
Intersect(Selection.EntireRow, Range("B:G")).Select
Selection.Copy
WJRep.Select
WJRep.Range("B1048576").End(xlUp).Select
ActiveCell.Offset(1, 0).Select
With Selection
.PasteSpecial Paste:=xlPasteValues
.PasteSpecial Paste:=xlPasteFormats
Application.CutCopyMode = False
sContagem = sContagem + 1
ActiveCell.Offset(0, -1).Value = sContagem
End With
WJog.Select
ActiveCell.Offset(1, -1).Activate
Else
ActiveCell.Offset(1, 0).Select
End If
Loop
WJog.Range("A11").Activate
WJRep.Select
WJRep.Range("A2:G2").Select
WJRep.Range(Selection, Selection.End(xlDown)).Select
Selection.FormatConditions.Delete
WJRep.Range("A2").Select
Resp = MsgBox("Deseja Imprimir os Jogos?", vbOKCancel, "Confirme a Impressão dos Dados...")
If Resp = vbCancel Then
GoTo Sair
Else
WJRep.PrintOut
End If
WJog.Select
Sair:
Application.ScreenUpdating = True
MsgBox "Foram copiadas : - " & sContagem & " - linhas"
End Sub
Existem mil maneiras de preparar Neston. Invente a sua!
http://www.youtube.com/ExpressoExcel
Postado : 04/12/2015 11:05 am