PDA

View Full Version : Solved: copy a range uniqe with out empty rows



Volvo850
08-02-2011, 11:18 PM
hello everyone!!

I am new til VBA and I am looking for a solution for the next action:

I want to copy a arange med data til a existing sheet, the data in the new sheet must be uniqe (added up if dobbel) and no empty rows.

I have made the code below but this does not do the trick.

:cool:

'selecteer de data in kolom B tm E
Sheets("Deleliste").Range("B1:E29").Select
Selection.Copy
Sheets("Printliste").Select
Range("A6").Select
ActiveSheet.Paste
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="<>"
Sheets("Deleliste").Select
'selecteer de data in kolom G tm J
Sheets("Deleliste").Range("G1:J29").Select
Selection.Copy
Sheets("Printliste").Select
Range("G6").Select
ActiveSheet.Paste
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="<>"
Sheets("Deleliste").Select

'selecteer de data in kolom Q tm T
Sheets("Deleliste").Range("Q1:T29").Select
Selection.Copy
Sheets("Printliste").Select
Range("A40").Select
ActiveSheet.Paste
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="<>"
Sheets("Deleliste").Select

'selecteer de data in kolom V tm Y
Sheets("Deleliste").Range("V1:Y29").Select
Selection.Copy
Sheets("Printliste").Select
Range("G40").Select
ActiveSheet.Paste
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="<>"
Sheets("Printliste").Select