Hi this is my first time using this and I am somewhat of a beginner when it comes to Visual Basic. I was trying to make a code that would read in two columns of script and check if there is any new data in the new script that is not in the old script and then record that data. Here is what I have so far.
Function PropLed(newcol As Range, oldcol As Range) As Variant
' Variables and Constants
Dim newcheck As String, oldcheck As String
Dim n As Integer, i As Integer, m As Integer
n = newcol.Count
m = 0
ReDim sol(1 To n) As String
' For loop to read through everything
For i = 1 To n
newcheck = WorksheetFunction.Lookup(newcol(i), oldcol, oldcol)
' If statement to check if it is in the new sheet
If newcheck = "#N/A" Then
m = m + 1
sol(m) = newcol(i)
Else
End If
Next i
'Solution Output
PropLed = WorksheetFunction.Transpose(sol)
End Function
The error is the standard #VALUE! value is in the wrong data type. I am reading in script and I am trying to output script. Should I be using a different function other that Lookup? Or is what I am asking not possible? Again I don't know exactly what I can and can't do here. Any help at all would be greatly appreciated.
Function PropLed(newcol As Range, oldcol As Range) As Variant
' Variables and Constants
Dim newcheck As String, oldcheck As String
Dim n As Integer, i As Integer, m As Integer
n = newcol.Count
m = 0
ReDim sol(1 To n) As String
' For loop to read through everything
For i = 1 To n
newcheck = WorksheetFunction.Lookup(newcol(i), oldcol, oldcol)
' If statement to check if it is in the new sheet
If newcheck = "#N/A" Then
m = m + 1
sol(m) = newcol(i)
Else
End If
Next i
'Solution Output
PropLed = WorksheetFunction.Transpose(sol)
End Function
The error is the standard #VALUE! value is in the wrong data type. I am reading in script and I am trying to output script. Should I be using a different function other that Lookup? Or is what I am asking not possible? Again I don't know exactly what I can and can't do here. Any help at all would be greatly appreciated.