Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 25
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I play a .WAV file in Excel if a condition is met? Roy Excel Worksheet Functions 3 April 27th 06 07:24 PM
EXCEL FILE a copy/a copy/a copy ....filename ve New Users to Excel 1 September 29th 05 09:12 PM
Run a macro to copy selective items chrisdtran Excel Discussion (Misc queries) 2 August 12th 05 04:42 PM
Automatically copy selective sheets from one workbook to another Ann Excel Discussion (Misc queries) 0 March 1st 05 07:09 PM
copy / paste selective rows Kenny Kendrena via OfficeKB.com Excel Discussion (Misc queries) 5 February 7th 05 12:55 PM


All times are GMT +1. The time now is 11:32 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"