hi all,
i have two sheets which has thousand lines and i will update it daily so there will increase in line numbers day by day.. instead vlookup formula i planned to use worksheet function vlookup so that it can save time in calculating the worksheet for more than 10 mins. i tried with below code it was success but when the value is not found then it gives me a error "runtime error-1004" below is the vba code. is there any way we can run this without error pls help also
Sub test()
Dim x As Variant
Sheets("sheet1").Select
Range("h2").Select
Do
x = Application.WorksheetFunction.VLookup(ActiveCell.Offset(0, -7).Value, Worksheets("sheet2").Range("A:F"), 6, False)
If IsError(x) Then
ActiveCell.Value = "N\a"
Else
ActiveCell.Value = x
End If
ActiveCell.Offset(1, 0).Activate
Loop Until IsEmpty(ActiveCell.Offset(0, -7).Value)
End Sub
i have two sheets which has thousand lines and i will update it daily so there will increase in line numbers day by day.. instead vlookup formula i planned to use worksheet function vlookup so that it can save time in calculating the worksheet for more than 10 mins. i tried with below code it was success but when the value is not found then it gives me a error "runtime error-1004" below is the vba code. is there any way we can run this without error pls help also
Sub test()
Dim x As Variant
Sheets("sheet1").Select
Range("h2").Select
Do
x = Application.WorksheetFunction.VLookup(ActiveCell.Offset(0, -7).Value, Worksheets("sheet2").Range("A:F"), 6, False)
If IsError(x) Then
ActiveCell.Value = "N\a"
Else
ActiveCell.Value = x
End If
ActiveCell.Offset(1, 0).Activate
Loop Until IsEmpty(ActiveCell.Offset(0, -7).Value)
End Sub