Reputation: 77
I have copied and paste a code and it does not work properly. I have not changed anything and I am figuring out why it will not work. After a while i think I found the bug. I don't know how to fix it. This is the code
GroupPresence = WorksheetFunction.CountIf(Range("B1:D19"), salk)
it has to be something like this:
GroupPresence = WorksheetFunction.Worksheet("Sheet9").CountIf(Range("B1:D19"), salk)
The code is wrong? Does someone know what the correct code is in refering to another sheet.
Upvotes: 1
Views: 12698
Reputation: 53135
Wrong syntax. Use
WorksheetFunction.CountIf(Worksheets("Sheet9").Range("B1:D19"), Salk)
Upvotes: 6