EirikDaude
10-02-2009, 01:56 AM
I'm making a macro for (among other things) copying a selection of cells from one worksheet to another. According to the VBA-help it seems the method I'm using should work, but it seems that when I try to select the range I want to copy the "Cells()"-function returns the contents of the cell instead of the address. I've also tried using Cells().Address, but I didn't get that to work either.
Have any of you guys got any idea of a different approach I can use to acchieve the same result?
I'm using Excel 2003 with SP3 and Visual Basic 6.5.
Here's the code I've come up with:
For i = LBound(skift1MF) To UBound(skift1MF)
Sheets("Kompetanseoversikt").Range(Cells(skift1MF(i), 1), Cells(skift1MF(i), 8)).Select
Selection.Copy
Sheets("Kompetanseoversikt (2)").Range(Cells(5 + i, 1), Cells(5 + i, 8)).Select
ActiveSheet.Paste
Next
Have any of you guys got any idea of a different approach I can use to acchieve the same result?
I'm using Excel 2003 with SP3 and Visual Basic 6.5.
Here's the code I've come up with:
For i = LBound(skift1MF) To UBound(skift1MF)
Sheets("Kompetanseoversikt").Range(Cells(skift1MF(i), 1), Cells(skift1MF(i), 8)).Select
Selection.Copy
Sheets("Kompetanseoversikt (2)").Range(Cells(5 + i, 1), Cells(5 + i, 8)).Select
ActiveSheet.Paste
Next