slang
02-11-2019, 02:55 PM
OK, its been a while since I have done any coding and I must have lost a lot of brain cells in the last while. :)
I am having problems with qualifying the lsheet vlookup property. Doing something wrong
Sub removeprofiles()
Dim LastRow As Long
Dim terr As String
Dim crm As Integer
Dim current As Integer
Dim rang As Range
Dim i As Integer
Dim dSheet As Worksheet
Dim lSheet As Worksheet
Workbooks.Open Filename:="C:\BDR\33profiles.xls", Password:="offlimits1" 'this is the local workbook that needs to be verified
Set dSheet = Workbooks("33profiles.xls").Worksheets("sheet1")
Set lSheet = Workbooks("Assessment archive 2019.xlsm").Worksheets("accounts") 'this is the workbook withthe code in it
LastRow = dSheet.Range("A" & Rows.Count).End(xlUp).Row
For i = LastRow To 2 Step -1
current = WorksheetFunction.VLookup(dSheet.Range("A" & i), dSheet.Range("A2:u3000"), 21, False)
crm = WorksheetFunction.VLookup(dSheet.Range("A" & i), lSheet.Range("A2:C3000"), 3, False)
If crm <> current Then MsgBox "Wrong at row " & I 'this is where I will do something
Next
End Sub
I am having problems with qualifying the lsheet vlookup property. Doing something wrong
Sub removeprofiles()
Dim LastRow As Long
Dim terr As String
Dim crm As Integer
Dim current As Integer
Dim rang As Range
Dim i As Integer
Dim dSheet As Worksheet
Dim lSheet As Worksheet
Workbooks.Open Filename:="C:\BDR\33profiles.xls", Password:="offlimits1" 'this is the local workbook that needs to be verified
Set dSheet = Workbooks("33profiles.xls").Worksheets("sheet1")
Set lSheet = Workbooks("Assessment archive 2019.xlsm").Worksheets("accounts") 'this is the workbook withthe code in it
LastRow = dSheet.Range("A" & Rows.Count).End(xlUp).Row
For i = LastRow To 2 Step -1
current = WorksheetFunction.VLookup(dSheet.Range("A" & i), dSheet.Range("A2:u3000"), 21, False)
crm = WorksheetFunction.VLookup(dSheet.Range("A" & i), lSheet.Range("A2:C3000"), 3, False)
If crm <> current Then MsgBox "Wrong at row " & I 'this is where I will do something
Next
End Sub