Link to home
Start Free TrialLog in
Avatar of Jagwarman
Jagwarman

asked on

VBA RowTo .... stop it from going to end

I have the folowing code that will copy data from one sheet to another but when there is no data to copy it falls over and tell me Excel can not continue with available resources

WS.Range(RowFM & ":" & RowTO).EntireRow.Copy WSCopy.Cells(MaxRowCopy, "A")

When I hover over RowTo it tells me it returns 1048576

How do I stop it from falling over and trying to go to 1048576

Thanks
Avatar of Rgonzo1971
Rgonzo1971

Hi

How is RowTO defined ?

If RowTO = 1048576 Then
    MsgBox "No Data"
Else
    WS.Range(RowFM & ":" & RowTO).EntireRow.Copy WSCopy.Cells(MaxRowCopy, "A")
End If

Open in new window

Regards
How do you calculate RowTo?
ASKER CERTIFIED SOLUTION
Avatar of byundt
byundt
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial