Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50079

Copy range from multiple sheets, into a master sheet and moving over by variable col range

$
0
0
I'm trying to copy a range B3:B354 from multiple different sheets into a master sheet
So the master sheet will open the new sheet, copy the range into B3:B354 then close the sheet
and move to the next one then copy the range b3:354 to C3:C354 I'm having issue with getting it
to copy the value's over.... please help Code is below.
Code:

Sub Importer()
Dim wb As Workbook
    Application.ScreenUpdating = False ' turn off the screen updating
    Sheets("PC").Select

    Dim rngMyRange As Range, rngX As Range
   
    Set rngMyRange = ActiveSheet.Range("B1:B1")
   
    SheetCount = Range("A1").Value
   
    For Scarab = 2 To SheetCount + 1
    file = Cells(2, Scarab).Value
   
   
        Set wb = Workbooks.Open(file, True, True)
            ' read data from the source workbook
        With ThisWorkbook.Worksheets("PC")
            ' read data from the source workbook
           
           

            ThisWorkbook.Worksheets("PC").Range(Cells(2, Scarab), Cells(354, Scarab)).Value = wb.Worksheets("Ivy").Range("B3:B354").Value



           
        End With
Workbooks(file).Close False

   
    Next Scarab

End Sub


Viewing all articles
Browse latest Browse all 50079

Trending Articles