Results 1 to 8 of 8

Macro for copying and duplicating data based on a cell values.

Threaded View

  1. #1
    Registered User
    Join Date
    02-26-2007
    Location
    Vancouver, BC, Canada
    MS-Off Ver
    2007
    Posts
    22

    Question Macro for copying and duplicating data based on a cell values.

    I am trying to copy two cells from one worksheet to another in the same work book based on the value in Column B of one of the sheets. This is just a building block to a larger script I am going to create.

    Below is my attempt but I keep getting an error at Range(Cells(x, 3)).Select.

    Any help would be great.


    Sub Macro3()
    '
    ' Macro3 Macro
    '
    
    x = 2
    i = 1
    
    Do While i > 0
        Worksheets("Macro List").Activate
        Rows("3:3").Select
        Range("B3").Activate
        Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
        Range("B3").Select
        Worksheets("Gary Breakout").Activate
        Sheets("Gary Breakout").Select
        Range(Cells(x, 3)).Select
        Selection.Copy
        Worksheets("Macro List").Activate
        Sheets("Macro List").Select
        Range("B3").Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        Worksheets("Gary Breakout").Activate
        Sheets("Gary Breakout").Select
        Range(Cells(x, 4)).Select
        Application.CutCopyMode = False
        Selection.Copy
        Worksheets("Macro List").Activate
        Sheets("Macro List").Select
        Range("C3").Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        Range("D3").Select
        
        i = Cells(x, 2)
            x = x + 1
        Loop
        
    End Sub
    Last edited by outthere; 08-25-2009 at 12:32 PM. Reason: solved

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