Dear Gents,
I test the following code and show an error Runtime error 1004 Method 'Range' of object '_worksheet' failed.
Would you please help me to figure out why bold codes have range problem?
Thanks.
I test the following code and show an error Runtime error 1004 Method 'Range' of object '_worksheet' failed.
Would you please help me to figure out why bold codes have range problem?
Thanks.
Code:
dim rng As Range
dim VD, VC As Integer
dimi as integer
VD = Sheet1.Cells.Find(what:="VisitD").Column
VC = Sheet1.Cells.Find(what:="VisitC").Column
Sheet7.Select
ActiveSheet.Unprotect "1234"
Application.ScreenUpdating = False
Set rng = Cells.Find(what:="Daily Activity Breadkdown").Offset(1, 2).Range("A1")
For i = 0 To Day(Now()) - 1
[B]Cells(rng.Row, rng.Column + i).Value = WorksheetFunction.CountIfs(Sheet1.Range(Cells(10, VD), Cells(1010, VD)), i + 1, Sheet1.Range(Cells(10, VC), Cells(1010, VC)), "F") _
+ WorksheetFunction.CountIfs(Sheet1.Range(Cells(10, VD), Cells(1010, VD)), i + 1, Sheet1.Range(Cells(10, VC), Cells(1010, VC)), "FP")[/B]
Next i