View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Per Jessen Per Jessen is offline
external usenet poster
 
Posts: 1,533
Default Copying of consecutive Rows, one at a time and pasting it in one location




Hi Per

Thanks a Ton. Your code worked perfectly ok. only the last bit,
i.e. ....

For Each c In Range("A9:T9")
If c.Value testval Then
testval = c.Value
ColOff = counter
End If
counter = counter + 1
Next
Range("D23:O23").Offset(ColOff - 1, 0).Copy Destination:=Range(DestRange)


..... i guess didnt work. Because finally depending upon the highest
value in A9:T9, the particular Row in the Range (D23:O42) gets copied
to Destination Range "D8". Am i right in understanding your code?..
But the final copying did not take place.

Could you please explain the above part of the code?

What is the initial value of 'testval'. Is that the highest value in
the Range A9:T9?

Thanks again for putting me on track


Hi again

Thanks for your reply.

The initial value of 'testval' is 0. After the loop it should be equal to
the highest value it the target range.

'ColOff' is the number of rows to offset. I.e pointing to the row to be
copied.

My mistake. Change the last line to this, and it should work for you :-)

Range("D23:O23").Offset(ColOff, 0).Copy Destination:=Range(DestRange)

Regards,

Per