I have a basic macro that is looking at a Cell in column B and then placing "NA" adjacent to the cell in column C based on the criteria I'm looking for. I have a type mismatch error and I don't understand why.
Sub badURLs()
Dim lr As Long ' Declare the variable
lr = Range("B2:B23068").End(xlUp).Row ' Set the variable
' lr now contains the last used row in column A
Application.ScreenUpdating = False
For a = lr To 1 Step -1
If InStr(1, a, "bloomberg" Or "wiki" Or "hoovers", vbTextCompare) > 0 Then
'Compares for bloomberg, wiki, or hoovers. Enters loop if value is greater than 0
With Cells(a, 3)
.NumberFormat = "General"
.Value = "NA"
End With
End If
Next a
Application.ScreenUpdating = True
End Sub
The mismatch error occurs here:
With Cells(a, 3)
lris ever be 0? Does it occur the first time theForloop runs? Also, addOption Explicitto the very top of your sub, and addDim a as Long(or a quickhand way isDim a&). - BruceWayne