I have a spreadsheet I'm trying to automate (I find that once people find out you can do that type of thing, they have more for you to do). I have the code below. When I run the code, it returns a 'Compile Error: Invalid Use of Argument' and highlights the 'Is Not Nothing' portion of my conditional statement. I asked google what it thought about this, but it wasn't giving me much that was helpful.
I would be grateful if someone could point in the direction of an answer to this problem. Thank you.
Here's the code...
![]()
Sub EverGreenPastures() '******* Put "Look Here" anywhere there are line names. *******' 'first import all line names in the spreadsheet to an array for comparison. Sheets("Info").Select Dim LineNameArray(1 To 6) As String RowCountForLineNames = Range("A6000").End(xlUp).Row For i = 1 To RowCountForLineNames LineNameArray(i) = Range("A" & i).Value Next i 'Put "Look Here" where needed. Sheets("AdHoc Report").Select Dim RowCount As Integer RowCount = Range("A50000").End(xlUp).Row For j = 1 To RowCount CurrentLineName = Range("A" & j).Value For k = 1 To UBound(LineNameArray) If CurrentLineName = LineNameArray(k) And CurrentLineName Is Not Nothing Then Range("Z" & j).Value = "Look Here" End If Next k Next j End Sub
Bookmarks