It seems like the range
lr = ws.Cells(Rows.Count, 1).End(xlUp).Offset(0, 10).Row
Set rng1 = ws.Range("K2" & lr)
is wrongly written because when i rewrite the code
lr = ws.Cells(Rows.Count, 1).End(xlUp).Row
Set rng1 = ws.Range(ws.Cells(2, 11), ws.Cells(lr, 11))
MsgBox WorksheetFunction.CountBlank(rng1)
rng1.Select
it works like intended
How should I construct the range code correctly?
Another question: why do not countA
Set rng2 = ws.Range(ws.Cells(2, 10), ws.Cells(lr, 10))
rng2.Select
a1 = Application.WorksheetFunction.CountA(rng2)
MsgBox a1
give the right answer, when the right range is selected? the answer I get is 32 when it should be 30. which is exaktly what this code
1 = Application.WorksheetFunction.CountA(ws.Range("K2:K821"))
gives
Bookmarks