Consulting

Results 1 to 5 of 5

Thread: Solved: How to copy data from one sheet to another

  1. #1
    VBAX Regular
    Joined
    Jul 2007
    Posts
    18
    Location

    Solved: How to copy data from one sheet to another

    I know this is a very easy task but i need to know the macro to copy a certain range of data from one sheet to another.
    This range is dynamic and changes on a regular basis.

  2. #2
    VBAX Master
    Joined
    Jun 2007
    Location
    East Sussex
    Posts
    1,110
    Location
    The basic syntax is:
    [VBA]Worksheets("sheet1").Range("Data").Copy Worksheets("Sheet2").Range("A1")[/VBA]
    where Data is the name of the range to copy.
    Regards,
    Rory

  3. #3
    VBAX Regular
    Joined
    Jul 2007
    Posts
    18
    Location
    sorry about my lack of VB knowledge, but can you send me the entire code?
    Eg:
    I need to copy whatever data is from column A to D on sheet 1
    and then paste the entire data in sheet 2 as values only.

  4. #4
    VBAX Master
    Joined
    Jun 2007
    Location
    East Sussex
    Posts
    1,110
    Location
    Off the top of my head, something like this:
    [VBA]Dim lngRows as Long
    With Worksheets("sheet1")
    lngRows = .Cells(.Rows.Count, 1).End(xlUp).Row
    .Range("A1" & lngRows).Copy
    End With
    Worksheets("Sheet2").Range("A1").PasteSpecial xlPasteValues[/VBA]

    Regards,
    Rory

  5. #5
    VBAX Regular
    Joined
    Jul 2007
    Posts
    18
    Location
    Thanks

Posting Permissions

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