Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Selective Copy from other excel file, sort, then deleteon a condition
Hi. I have two excel files, Excel-1 and Excel-2. I must copy from Excel-1 to Excel-2 only some columns (for example A,B,D and G). After this copy, in the Excel-2 file, i must search in a column (A) for duplicates. If i found one, a script must delete the entire row. (for example A34 and A45 are the same with A2 - then i should delete A34 and A45)
The A file is updated daily - that's why I need a macro to be run every day to check if new rows appeared, and if yes, to add them by the end of Excel-B. Can you help me please in this problem? Thank you very much! EggHeadCafe - .NET Developer Portal of Choice http://www.eggheadcafe.com |
#2
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Selective Copy from other excel file, sort, then delete on a condi
Hello,
If I understand well your question, then I would use a double loop for your problem Private Sub CommandButton1_Click() Dim rng1, rng2 As Range Dim mycell1, mycell2 As Range Set rng = Range("A1:A15") For Each mycell1 In rng For Each mycell2 In rng If (mycell2.Text = mycell1.Text) And (mycell1.Row < mycell2.Row) Then rng.Rows(mycell2.Row).Delete End If Next Next End Sub You need to modify the code according to your needs! Regards, Zoltan "Adi M" wrote: Hi. I have two excel files, Excel-1 and Excel-2. I must copy from Excel-1 to Excel-2 only some columns (for example A,B,D and G). After this copy, in the Excel-2 file, i must search in a column (A) for duplicates. If i found one, a script must delete the entire row. (for example A34 and A45 are the same with A2 - then i should delete A34 and A45) The A file is updated daily - that's why I need a macro to be run every day to check if new rows appeared, and if yes, to add them by the end of Excel-B. Can you help me please in this problem? Thank you very much! EggHeadCafe - .NET Developer Portal of Choice http://www.eggheadcafe.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How can I play a .WAV file in Excel if a condition is met? | Excel Worksheet Functions | |||
EXCEL FILE a copy/a copy/a copy ....filename | New Users to Excel | |||
Run a macro to copy selective items | Excel Discussion (Misc queries) | |||
Automatically copy selective sheets from one workbook to another | Excel Discussion (Misc queries) | |||
copy / paste selective rows | Excel Discussion (Misc queries) |