Copy a by macro special selected nr of rows into another file
As part of a complex process of actions, there is a new part where I can use some help. I think it's easy if you knows the correct code :) (as Always).
File1/Sheet1:
contains a heading in row 1 and several data in records row 2 till last, whereby in column A for some records the data in it is the same and those who are the same are always sorted by each other.
Example:
1. Heading
2. AAA
3. AAA
4. AAA
5. BBB
6. BBB
7. CCC
8. DDD
9. DDD
When run the macro the required action is;
Step1:
1a) For the active cell (standing at that moment) look at the data in the active record in column A and select then all the complete rows were in column A the data is the same.
1b) Copy all the selected records.
1c) Keep in memory the active file/sheet name.
(This means when I run the macro and the active cell is D3, the macro select then the complete rows 2+3+4 because they have the same data in column A. Then it selects all this rows and keep in mind the name File1/Sheet1).
File1/Sheet2:
This contains in datafield A2 the reference to a file.
For example c:/Apps/import.xls
Step2:
2a) The macro should open the file as mentioned in File1/Sheet2 field A2 (then you opens File2/Sheet1).
2b) Then in this opened file delete all the records in it from row2 till last.
2c) Then copy the selected records from step1b of File1/Sheet1 into row2 etc of this File2/Sheet1.
2d) Save/Close the file File2.
Step3:
In the selected records of File1/Sheet1 set in all those records in column B the actual date of this copy action.
If somebody can help me out, thanks.
regards,
Johan
|