+ Reply to Thread
Results 1 to 3 of 3

Macro to Copy/Paste Data from One Sheet to Another

Hybrid View

  1. #1
    Registered User
    Join Date
    08-13-2007
    Posts
    68

    Unhappy Macro to Copy/Paste Data from One Sheet to Another

    Hey guys...I've run into a snag that I think has an easy fix. I believe that i know how I want this process to run, I'm having trouble executing it.

    Here's the details: I have a spreadsheet (see attached image) that contains a record of time (in months) running across the sheet (the columns) and down the side (the rows) is a list of products. Within these cell blocks (divided by month and product) are some dates pertaining to order shipments.

    I am trying to create a macro that will loop through each row and determine if the cells cantain data, if they do contain data I would like that copied and pasted to a new sheet. After copying/pasting the shipment data the macro will have to copy/paste the product name from column A of the applicable row.

    Essentially this will build a user firendly database that I can easily organize and work from.

    Please feel free to inquire if I did not explain this well.

    Thank you in andvance for any help.
    Attached Images Attached Images

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    A workbook example with data and how you want it collating would be better than an image.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    08-13-2007
    Posts
    68
    I have used the Macro Recorder to help copy/paste data from a group of cells to a new page. The group of cells are copied separately and increment all the way across the page. (The code will explain this easier).

    Is there an easy way to implement a loop to repeat this same program going down the page? i.e. the next group of cells I would want to copy would be
    C14:F19 , I14:L19, etc. all the way to the row starting with C356:F361

    The code has been shortened to fit into the post, but should give the general idea.

    [CODE]
    Sub Sort()
    '
    ' Sort Macro
    ' Macro recorded 11/9/2007 by BF
    '
    
    '
        Range("C5:F10").Select
        Selection.Copy
        Sheets("Sheet1").Select
        Range("B3").Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        Sheets("On Time Orders and Del.").Select
        Range("B5").Select
        Application.CutCopyMode = False
        Selection.Copy
        Sheets("Sheet1").Select
        Range("A3:A8").Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        Sheets("On Time Orders and Del.").Select
        Range("I5:L10").Select
        Application.CutCopyMode = False
        Selection.Copy
        Sheets("Sheet1").Select
        Range("B9").Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        Sheets("On Time Orders and Del.").Select
        Range("B5").Select
        Application.CutCopyMode = False
        Selection.Copy
        Sheets("Sheet1").Select
        Range("A9:A14").Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        Sheets("On Time Orders and Del.").Select
        ActiveWindow.SmallScroll ToRight:=7
        Range("O5:R10").Select
        Application.CutCopyMode = False
        Selection.Copy
        Sheets("Sheet1").Select
        Range("B15").Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        Sheets("On Time Orders and Del.").Select
    
        Range("B5").Select
        Application.CutCopyMode = False
        Selection.Copy
        Sheets("Sheet1").Select
        Range("A15:A20").Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        Sheets("On Time Orders and Del.").Select
        ActiveWindow.SmallScroll ToRight:=13
        Range("U5:X10").Select
        Application.CutCopyMode = False
        Selection.Copy
        Sheets("Sheet1").Select
        Range("B21").Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        Sheets("On Time Orders and Del.").Select
        
        Range("B5").Select
        Application.CutCopyMode = False
        Selection.Copy
        Sheets("Sheet1").Select
        Range("A21:A26").Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
    I know it is crude...but I have developed a macro to just copy/paste the data. However the code is very long and I could use some help with a Loop. I created a new thread concerning this:http://www.excelforum.com/showthread.php?t=622259

    Thanks for any help.
    Last edited by VBA Noob; 11-09-2007 at 02:42 PM.

+ 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