Need help in data copying.

S

SMILE

Hi Dave

Thanks for your reply.
It is working perfect *if there is more than one row*.

But If I have the data only one row (B8 in my case) , then it selec
the data till the end of the file ( till Row no. 65536)

I will appreciate your reply.
Tom
 
B

Bernie Deitrick

SMILE,

Don't use .End(xlDown)

For example, if the code is

Range(ActiveCell, ActiveCell.End(xlDown)).Select

Change it to

Range(ActiveCell, Cells(65536, ActiveCell.Column).End(xlUp)).Select

HTH,
Bernie
MS Excel MVP
 
D

Dave Peterson

I'd change this portion:
With InvWks
.Range("b8", .Range("b8").End(xlDown)).Resize(, 5).Copy
End With
to
With InvWks
.Range("b8", .cells(.rows.count,"B").End(xlup)).Resize(, 5).Copy
End With

But that does assume you have something in B8.
 
Top