Hi all,
I have a macro that is trying to copy rows over from one workbook to another based on whether the values in column AR (column 44) are not equal to 0. However, I'm getting an "error 400" every time i try to run it, without direction to which line is causing the error. Does anyone have any ideas as to what might be causing the problem? Below is my code:
Also don't know if it's relevant but I'm using Excel 2013. Thanks in advance for all your help!
I have a macro that is trying to copy rows over from one workbook to another based on whether the values in column AR (column 44) are not equal to 0. However, I'm getting an "error 400" every time i try to run it, without direction to which line is causing the error. Does anyone have any ideas as to what might be causing the problem? Below is my code:
Code:
Sub EIB_Populate()
Dim LastRow As Integer, i As Integer, erow As Integer
LastRow = ActiveSheet.Range(“B” & Rows.Count).End(xlUp).Row
For i = 6 To LastRow
If Cells(i, 44).Value <> 0 Then
ActiveSheet.Range(Cells(i, 1), Cells(i, 44)).Select
Selection.Copy
'Open EIB compiled workbook'
Dim y As Workbook
Set y = Workbooks.Open("C:\Users\37181\Documents\EIB Compiled.xlsx")
y.Sheets("Sheet1").Select
erow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
ActiveSheet.Cells(erow, 1).Select
ActiveSheet.PasteSpecial Paste:=xlPasteValues
End If
Next i
End Sub
Also don't know if it's relevant but I'm using Excel 2013. Thanks in advance for all your help!