I am writing a macro to copy data from one workbook to another, from specific columns while check if any of the cells are NA
ive tried changing references
Sub Update_Account()
Dim ws As Worksheet
Dim ws2 As Worksheet
Dim LastRow As Integer
Dim SourceRows As Integer
Dim I As Integer
Workbooks.Open "C:\Users\willi\Documents\Excel\Text.xlsx"
Set ws = ThisWorkbook.Worksheets("LookupLists")
Set ws2 = Workbooks("Text.xlsx").Worksheets("Test")
SourceRows = ws2.Application.WorksheetFunction.CountA(Columns(1)) - 1
For I = 2 To SourceRows
If ws2.Application.WorksheetFunction.IsNA(ws2.Cells(I, 2)) Then
Else
LastRow = ws.Application.WorksheetFunction.CountA(Columns(26))
ws2.Range(Cells(I, 1), Cells(I, 3)).Copy
ThisWorkbook.Worksheets("LookupLists").Cells(LastRow, 26).Paste
End If
Next I
End Sub
it should copy but instead it gives me error 1004