+ Reply to Thread
Results 1 to 2 of 2

copy method failed:application-defined or object-defined error'

  1. #1
    Registered User
    Join Date
    04-06-2005
    Posts
    2

    Unhappy copy method failed:application-defined or object-defined error'

    im trying to use this simple code t o copy a particular range from particular sheet to another sheet and specified range.but im encountering the following "application-defined or object-defined error":



    For i = 1 To 3

    Worksheets("sheet1").Range(Cells(i, 1), Cells(i, 30)).Copy Destination:=(Worksheets("sheet2").Cells(i, 1))
    Next

    the above code runs from combobox event which is placed in sheet2 i.e, the destination sheet

    Im using office 2002

    can any body help me out

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Syam1919,

    You need to select the range before you copy it.

    You have:
    Worksheets("sheet1").Range(Cells(i, 1), Cells(i, 30)).Copy Destination:=(Worksheets("sheet2").Cells(i, 1))


    Change to:
    Worksheets("Sheet1").Range(Cells(i, 1), Cells(i, 30)).Select
    Selection.Copy Destination:=Worksheets("Sheet2").Range(Cells(i, 1).Address)


    This will fix it,
    Leith Ross

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1