vendredi 4 avril 2014

VBA 2010 copying range cells between 2 sheets on the same workbook avoid loop


Vote count:

0




Theses lines are intended to copy a range of one line cells from a sheet (source) to another (target) on the same workbook.


The following code raises error 1004 - Application-defined or objetc-defined :


currBook.Sheets(strNomOnglet).Range(Cells(firstrow, 2), Cells(firstrow, 8)).Copy _Destination:=currBook.Sheets(strOngletCibl).Range("B1:H1")


firstrow variable is a seeking sequence result.


This one is ok but, too static (not relative referencing) :


currBook.Sheets(strNomOnglet).Range("B26:H26").Copy _Destination:=currBook.Sheets(strOngletCibl).Range("B1:H1")


I'd like to avoid using a loop ...


Any tips or explanation for that issue ?


Regards.



asked 1 min ago






Aucun commentaire:

Enregistrer un commentaire