Transferring values from one worksheet to another using If, Then And Statement

Viewed 26

In writing this code I am coming up with a invalid next variable reference. What am I doing wrong? My intent is to place values from one worksheet into another given a cell's value or string id.

Dim Rev_2, Sch, vet                  As Worksheet
Dim i, Row, RowNum                   As Long
Dim FRow, FirstRow, lastRow, LRow    As Integer

FirstRow = 4
FRow = 4
lastRow = ActiveWorkbook.Worksheets("Rev_2").Range("L" & Rows.Count).End(xlUp).Row
LRow = ActiveWorkbook.Worksheets("Vet Raw Data").Range("A" & Rows.Count).End(xlUp).Row
On Error Resume Next
Set Sch = Worksheets("Rev_2")
Set vet = Worksheets("Vet Raw Data")
MsgBox (lastRow)
MsgBox (LRow)
LRow = Range("A" & Rows.Count).End(xlUp).Row
For RowNum = FirstRow To lastRow
    For Row = FRow To LRow
        If Sheets("Rev_2").Cells(RowNum, 16).Value = "MACH_SHOP" Then Sheets("Vet Raw Data").Cells(Row, 11).Value = Sheets("Rev_2").Cells(RowNum, 14).Value And Sheets("Vet Raw Data").Cells(Row, 39).Value = Sheets("Rev_2").Cells(RowNum, 15).Value
    Next RowNum
Next Row
End Sub
0 Answers
Related