The idea is to count the number of cells in a range and check each cell if the value is bigger than 0 if yes type "Overdue" otherwise type "Non overdue" Could someone help me?
my below code is not working
error 438/ object doesnt support this property or methode
show up in line where IF start.
Option Explicit
Sub investigate()
Dim wb1 As Workbook
Dim w As String
Dim Name1 As String
Dim Path1 As String
Dim Lr As Integer
w = 2
Name1 = ThisWorkbook.Sheets("vba").Cells(w + 4, 1).Text
Path1 = ThisWorkbook.Sheets("Path").Cells(1, 2) & "Download\"
Set wb1 = Workbooks.Open(Path1 & Name1)
Lr = wb1.Sheets("Sheet1").Range("V" & Application.Rows.Count).End(xlUp).Row
If Application.WorksheetFunction.CountIf(wb1.Range("V" & Lr), ">" & 0) > 0 Then
ThisWorkbook.Sheets("vba").Cells(w + 4, 2).Value = "Overdue"
Else
ThisWorkbook.Sheets("vba").Cells(w + 4, 2).Value = "No Overdue"
End If
wb1.Close
End Sub