Results 1 to 4 of 4

Program to copy array of values one at a time

Threaded View

  1. #1
    Registered User
    Join Date
    08-15-2011
    Location
    Kansas City,MO
    MS-Off Ver
    Excel 2010
    Posts
    2

    Program to copy array of values one at a time

    Newbee to VBA & programming so please bear with me. I have a complicated flow formula (includes predefined parameters) which takes "two input variables" and gives me the output. I would now like a code to copy a series of values one at a time into these two input cells and record all output data in an array.

    I illustrate this operation by recording a macro for which I have included the code below. I would like to keep my equations visible within excel because of the parameters and steps involved in calculating the end value.

    Sub popsys()
    '
    ' popsys Macro
    '
    
    '
        ActiveCell.Offset(0, -2).Range("A1").Select
        Selection.Copy
        ActiveCell.Offset(2, -1).Range("A1").Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        ActiveCell.Offset(-2, 2).Range("A1").Select
        Application.CutCopyMode = False
        Selection.Copy
        ActiveCell.Offset(3, -2).Range("A1").Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        ActiveCell.Offset(1, 0).Range("A1").Select
        Application.CutCopyMode = False
        Selection.Copy
        ActiveCell.Offset(-4, 3).Range("A1").Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        ActiveCell.Offset(1, -2).Range("A1").Select
        Application.CutCopyMode = False
        Selection.Copy
        ActiveCell.Offset(1, -1).Range("A1").Select
        ActiveSheet.Paste
        ActiveCell.Offset(-1, 2).Range("A1").Select
        Application.CutCopyMode = False
        Selection.Copy
        ActiveCell.Offset(2, -2).Range("A1").Select
        ActiveSheet.Paste
        ActiveCell.Offset(1, 0).Range("A1").Select
        Application.CutCopyMode = False
        Selection.Copy
        ActiveCell.Offset(-3, 3).Range("A1").Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        ActiveCell.Offset(1, -2).Range("A1").Select
        Application.CutCopyMode = False
        Selection.Copy
        ActiveCell.Offset(0, -1).Range("A1").Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        ActiveCell.Offset(0, 2).Range("A1").Select
        Application.CutCopyMode = False
        Selection.Copy
        ActiveCell.Offset(1, -2).Range("A1").Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        ActiveCell.Offset(1, 0).Range("A1").Select
        Application.CutCopyMode = False
        Selection.Copy
        ActiveCell.Offset(-2, 3).Range("A1").Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        ActiveCell.Offset(1, -2).Range("A1").Select
        Application.CutCopyMode = False
        Selection.Copy
        ActiveCell.Offset(-1, -1).Range("A1").Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        ActiveCell.Offset(1, 2).Range("A1").Select
        Application.CutCopyMode = False
        Selection.Copy
        ActiveCell.Offset(0, -2).Range("A1").Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        ActiveCell.Offset(1, 0).Range("A1").Select
        Application.CutCopyMode = False
        Selection.Copy
        ActiveCell.Offset(-1, 3).Range("A1").Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
    End Sub
    Attached Files Attached Files
    Last edited by p282h; 08-19-2011 at 12:38 PM.

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