Results 1 to 14 of 14

Thread: Solved: combine data from spreadsheet help

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Newbie
    Joined
    Jun 2012
    Posts
    5
    Location

    Solved: combine data from spreadsheet help

    Hi,

    I am new to the forum and new to VBA. I am trying to combine data from multiple worksheets into a single new worksheet. I have 3 worksheets with 1975 rows each. I would like to combine the data from these sheets from left to right in the new sheet. I have found a code that will combine them one on top of the other and don't know how to (or if i can) adjust this code to add these data from left to right.

    [vba]Sub Combine()
    Dim NumSheets As Integer
    Dim NumRows As Integer
    NumSheets = 3
    NumRows = 1975
    Worksheets(1).Select
    Sheets.Add
    ActiveSheet.Name = "Consolidated"
    For X = 1 To NumSheets
    Worksheets(X + 1).Select
    Rows("1:" & NumRows).Select
    Selection.Copy
    Worksheets("Consolidated").Select
    ActiveSheet.Paste
    Selection.End(xlDown).Select
    ActiveCell.Offset(1, 0).Select
    Worksheets(X + 1).Select
    Range("A1").Select
    Next X
    Worksheets("Consolidated").Select
    Range("A1").Select
    End Sub
    [/vba] Is there a simple way to adjust this code? Any help will be greatly appreciated. Thanks!
    Attached Files Attached Files
    Last edited by Aussiebear; 06-12-2012 at 11:43 AM. Reason: Added tags to code

Posting Permissions

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