Boa noite!!!
Tem um opção...utilizando VBA.
Faça uma adaptação.
Sub macroAle()
Application.ScreenUpdating = False
Dim AllCells As Range
Dim cell As Range, Rng As Range
Dim NoDupes As New Collection
Dim lrow As Long
Dim Myval As Integer
lrow = Sheets("Base").Range("C65536").End(xlUp).Row
Set AllCells = Sheets("Base").Range("C2:C" & lrow)
For Each cell In AllCells
On Error Resume Next
NoDupes.Add cell.Value, CStr(cell.Value)
Next cell
On Error GoTo 0
For Each Item In NoDupes
Union(Range("B:B"), Range("D:D")).EntireColumn.Hidden = True
Range("A1:I1").Select
Selection.AutoFilter
With Selection
.AutoFilter Field:=3, Criteria1:=Item '' this set the filtered data for the value
End With
Set Rng = ActiveSheet.AutoFilter.Range
'' make sure you have more than 1 row to copy ''
Myval = Range("C2:C" & lrow).SpecialCells(xlCellTypeVisible).Count
If Myval <> "1" Then
Rlrow = Sheets(Item).Range("A65536").End(xlUp).Row + 1
Rng.Offset(1, 0).Resize(Rng.Rows.Count - 1).Copy
Sheets(Item).Cells(Rlrow, 1).PasteSpecial xlValue
Application.CutCopyMode = xlCopy
End If
Next Item
Selection.AutoFilter
Union(Range("B:B"), Range("D:D")).EntireColumn.Hidden = False
End Sub
Sub Macro1()
Dim HowManyVisRows As Long
Dim VisRng As Range
'apply the filter someway
Dim iCtr As Long
With Worksheets("Base").AutoFilter.Range
'subtract one for the header.
HowManyVisRows _
= .Columns(1).Cells.SpecialCells(xlCellTypeVisible).Cells.Count - 1
If HowManyVisRows >= 2 Then
'avoid the header and come down one row
'and only look at one the first column
Set VisRng = .Resize(.Rows.Count - 1, 1).Offset(1, 0) _
.Cells.SpecialCells(xlCellTypeVisible)
'VisRng.Offset(1, 0).Select
'With ActiveCell
Range(Cells(VisRng.Offset(0, 0).Row, 1), Cells(Range("D65536").End(xlUp).Row, 9)).Copy 'EntireRow.Delete
'VisRng.Offset(1, 0).Resize(VisRng.Rows.Count - 1).Copy
Sheets("Product1").Cells(2, 1).PasteSpecial xlValue
Application.CutCopyMode = xlCopy
'End With
End If
End With
End Sub
Existem mil maneiras de preparar Neston. Invente a sua!
http://www.youtube.com/ExpressoExcel
Postado : 09/02/2012 7:11 pm