eliasbyvasoula
Sep 5th, 2010, 06:44 PM
as i am a newbie to that field, i have the following code.
I would like to make it shorter and better.
Note that this code copies some cells from one worksheet to another worksheet, only at the last row that is empty.
this code must be repeated for 20 or more times. Range(*90) shows the place for the data for MIG. The range 89 show the place for ATE.
Finally, at the final code "BBB" will become "ccc", "DDD", for each type e.g bbb--> Mig, CCC-->ATE etc. Thats it.
so i am confused with ifs and thens, i tried to make something but not work (obviously). Therefore, i need your help!
Workbooks.Open Filename:="D:\MARFIN\VASIKA ARXEIA\NAFTEMPORIKI.xls"
Windows("NAFTEMPORIKI.xls").Activate
Sheets("AAA").Select
Range("O90").Select
Selection.Copy
Windows("OLA 20.xlsx").Activate
Sheets("MIG").Select
Range("c65536").End(xlUp).Offset(1, 0).PasteSpecial
Windows("NAFTEMPORIKI.xls").Activate
Sheets("AAA").Select
Range("K90").Select
Selection.Copy
Windows("OLA 20.xlsx").Activate
Sheets("MIG").Select
Range("D65536").End(xlUp).Offset(1, 0).PasteSpecial
Windows("NAFTEMPORIKI.xls").Activate
Sheets("AAA").Select
Range("L90").Select
Selection.Copy
Windows("OLA 20.xlsx").Activate
Sheets("MIG").Select
Range("E65536").End(xlUp).Offset(1, 0).PasteSpecial
Windows("NAFTEMPORIKI.xls").Activate
Sheets("AAA").Select
Range("M90").Select
Selection.Copy
Windows("OLA 20.xlsx").Activate
Sheets("MIG").Select
Range("F65536").End(xlUp).Offset(1, 0).PasteSpecial
Windows("NAFTEMPORIKI.xls").Activate
Sheets("AAA").Select
Range("C90").Select
Selection.Copy
Windows("OLA 20.xlsx").Activate
Sheets("MIG").Select
Range("G5536").End(xlUp).Offset(1, 0).PasteSpecial
Windows("NAFTEMPORIKI.xls").Activate
Sheets("AAA").Select
Range("N90").Select
Selection.Copy
Windows("OLA 20.xlsx").Activate
Sheets("MIG").Select
Range("H5536").End(xlUp).Offset(1, 0).PasteSpecial
Windows("NAFTEMPORIKI.xls").Activate
Sheets("BBB").Select
Range("H212").Select
Selection.Copy
Windows("OLA 20.xlsx").Activate
Sheets("MIG").Select
Range("I65536").End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
Cells.Replace what:=Chr(44), Replacement:=Chr(46)
End Sub
I would like to make it shorter and better.
Note that this code copies some cells from one worksheet to another worksheet, only at the last row that is empty.
this code must be repeated for 20 or more times. Range(*90) shows the place for the data for MIG. The range 89 show the place for ATE.
Finally, at the final code "BBB" will become "ccc", "DDD", for each type e.g bbb--> Mig, CCC-->ATE etc. Thats it.
so i am confused with ifs and thens, i tried to make something but not work (obviously). Therefore, i need your help!
Workbooks.Open Filename:="D:\MARFIN\VASIKA ARXEIA\NAFTEMPORIKI.xls"
Windows("NAFTEMPORIKI.xls").Activate
Sheets("AAA").Select
Range("O90").Select
Selection.Copy
Windows("OLA 20.xlsx").Activate
Sheets("MIG").Select
Range("c65536").End(xlUp).Offset(1, 0).PasteSpecial
Windows("NAFTEMPORIKI.xls").Activate
Sheets("AAA").Select
Range("K90").Select
Selection.Copy
Windows("OLA 20.xlsx").Activate
Sheets("MIG").Select
Range("D65536").End(xlUp).Offset(1, 0).PasteSpecial
Windows("NAFTEMPORIKI.xls").Activate
Sheets("AAA").Select
Range("L90").Select
Selection.Copy
Windows("OLA 20.xlsx").Activate
Sheets("MIG").Select
Range("E65536").End(xlUp).Offset(1, 0).PasteSpecial
Windows("NAFTEMPORIKI.xls").Activate
Sheets("AAA").Select
Range("M90").Select
Selection.Copy
Windows("OLA 20.xlsx").Activate
Sheets("MIG").Select
Range("F65536").End(xlUp).Offset(1, 0).PasteSpecial
Windows("NAFTEMPORIKI.xls").Activate
Sheets("AAA").Select
Range("C90").Select
Selection.Copy
Windows("OLA 20.xlsx").Activate
Sheets("MIG").Select
Range("G5536").End(xlUp).Offset(1, 0).PasteSpecial
Windows("NAFTEMPORIKI.xls").Activate
Sheets("AAA").Select
Range("N90").Select
Selection.Copy
Windows("OLA 20.xlsx").Activate
Sheets("MIG").Select
Range("H5536").End(xlUp).Offset(1, 0).PasteSpecial
Windows("NAFTEMPORIKI.xls").Activate
Sheets("BBB").Select
Range("H212").Select
Selection.Copy
Windows("OLA 20.xlsx").Activate
Sheets("MIG").Select
Range("I65536").End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
Cells.Replace what:=Chr(44), Replacement:=Chr(46)
End Sub