+ Reply to Thread
Results 1 to 1 of 1

Paste into non sequential rows

Hybrid View

Wheelie686 Paste into non sequential rows 10-31-2012, 01:15 PM
  1. #1
    Forum Contributor
    Join Date
    05-27-2012
    Location
    New Brunswick, Canada
    MS-Off Ver
    Excel 2016
    Posts
    349

    Paste into non sequential rows

    I have an array (see below) which copies A3:A50 from each sheet and pastes it into H2:H49 of another workbook. The question is how do I modify my array so that it pastes each selection from my array but instead of always using H2:H49, it jumps down by 47 rows before it moves onto the next sheet in my array?

    Sub SaturdayTEST()
    Application.ScreenUpdating = False
    
    Dim wbTemplate As Workbook
    Dim wbForecast As Workbook
    Dim wbConsol As Workbook
    Dim I As Long
    Dim J As Long
    Dim arrSheets
    
        varFilename = Application.GetOpenFilename("Excel Files (*.xls), *.xls", MultiSelect:=False)
        
        If TypeName(varFilename) = "Boolean" Then Exit Sub
        
        Set wbConsol = Workbooks.Open(varFilename)
        
        Set wbForecast = Workbooks("Forecast - 20xx-xx-xx.xlsm")
        
        arrSheets = Array("BHSI", "CHSI", "HPTS", "IPTV", "TRUE Repair")
    
        For J = LBound(arrSheets) To UBound(arrSheets)
          For I = 0 To 6
            wbForecast.Sheets(arrSheets(J)).Range("A3:A50").Copy
            wbConsol.Sheets("Data").Range("H2:H49").PasteSpecial Paste:=xlPasteValues
          Next I
        Next J
    Application.ScreenUpdating = True
    End Sub
    Last edited by Wheelie686; 11-09-2012 at 01:01 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