0

I have 5 different arrays of data to export to a single closed workbook but each array has to paste to a different sheet into the next open row. I don't want any data to be overwritten just added too. This is what I have so far for one array. I know its not even close but any help would be appreciated.

Sub Export_Data_To_File()
Dim Y As Integer
Dim FileToOpen As Variant
Dim OpenBook As Workbook
Dim i As Integer
Application.ScreenUpdating = False
FileToOpen = Application.Workbook.Open("S:\Process Engineering\Team Documents\010 Alpha\Alpha Laser 
Calibration\Raw Data\Raycus Laser Decay Comparison.xlsx")
If FileToOpen <> False Then

    Set OpenBook = Application.Workbooks.Open(FileToOpen)
    ThisWorkbook.Worksheets("Raw Data").Range("G6:L6").Copy
     Y = 2
     i = 0
       Do While i = 0
        If Cells(Y, 2) = "" Then
            OpenBook.Worksheets("Sheet 1").Range("Y,2").PasteSpecial xlPasteValues
            i = 1
        Else
            Y = Y + 1
       End If
     Loop
End If
Application.ScreenUpdating = True
      
    Workbooks("Raycus Laser Decay Comparison.xlsm").Save
    OpenBook.Close False


End Sub
g0dsreaper
  • 35
  • 5

0 Answers0