copy table data in excel

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • joemo2003
    New Member
    • Feb 2007
    • 142

    copy table data in excel

    I try to copy one column of a table in excel, from top to end, so i use

    Worksheets("she et1").Range("F6 ", Range("F6").End (xlDown)).Copy
    , but it come out "Applicatio n-defined or object-defined error", anybody know what is wrong? The same code work for the column not in the table.

    thanks
  • joemo2003
    New Member
    • Feb 2007
    • 142

    #2
    in excel VBA macro, my full code is look something like this:
    Code:
    Sub copy_Click()
    Worksheets("Sheet1").Range("A1", Range("A1").End(xlDown)).Copy
    Worksheets("Sheet2").Activate
    Worksheets("Sheet2").Range("B2").Select
    ActiveSheet.Paste
    Worksheets("Sheet2").Cells(1, 1).Select
    Worksheets("Sheet3").Activate
    Application.CutCopyMode = False
    Worksheets("Sheet3").Range("C1", Range("C1").End(xlDown)).Copy
    Worksheets("Sheet3").Range("D1").Select
    ActiveSheet.Paste
    End Sub
    the code stop at
    Worksheets("She et3").Range("C1 ", Range("C1").End (xlDown)).Copy

    It seem like it is not a table problem. seem like it cannot be copy twice.

    help!
    thanks

    Comment

    • joemo2003
      New Member
      • Feb 2007
      • 142

      #3
      never mind ... got it

      Comment

      • SammyB
        Recognized Expert Contributor
        • Mar 2007
        • 807

        #4
        Originally posted by joemo2003
        in excel VBA macro, my full code is look something like this:
        Code:
        Sub copy_Click()
        Worksheets("Sheet1").Range("A1", Range("A1").End(xlDown)).Copy
        Worksheets("Sheet2").Activate
        Worksheets("Sheet2").Range("B2").Select
        ActiveSheet.Paste
        Worksheets("Sheet2").Cells(1, 1).Select
        Worksheets("Sheet3").Activate
        Application.CutCopyMode = False
        Worksheets("Sheet3").Range("C1", Range("C1").End(xlDown)).Copy
        Worksheets("Sheet3").Range("D1").Select
        ActiveSheet.Paste
        End Sub
        the code stop at
        Worksheets("She et3").Range("C1 ", Range("C1").End (xlDown)).Copy

        It seem like it is not a table problem. seem like it cannot be copy twice.

        help!
        thanks
        The problem is that the second Range is not qualified by a Worksheet so it defaults to the ActiveSheet. Instead of
        Worksheets("She et1").Range("A1 ", Range("A1").End (xlDown)).Copy
        you want
        Code:
        With Worksheets("Sheet1")
        	.Range("A1", .Range("A1").End(xlDown)).Copy
        End With
        (Notice both Ranges have a dot before them)

        Comment

        Working...