seekyourway
New Member
- Joined
- Nov 1, 2011
- Messages
- 21
Hi there,
I have a problem with the subscript out of range even though my worksheet is actually. code is:
error is on the one below a23 = a23 / totalclinicvolume.
Any thoughts?
I have a problem with the subscript out of range even though my worksheet is actually. code is:
Code:
Set wbPath = Workbooks.Open("H:\All Projects\test.xlsm", Password:="test")
Set SPHClinicAnalyzable = wbPath.Worksheets("teste").Range("W:W")
Set SPHClinicPeriod = wbPath.Worksheets("test").Range("N:N")
Dim a23 As Double '% of VGH ED of total clinic volume
'adding up all three clinic volumes
TotalClinicVolume = Application.WorksheetFunction.CountIfs(SPHClinicAnalyzable, "Yes", SPHClinicPeriod, mPeriod) + Application.WorksheetFunction.CountIfs(LGHClinicAnalyzable, "Yes", LGHClinicPeriod, mPeriod) + Application.WorksheetFunction.CountIfs(VGHClinicAnalyzable, "Yes", VGHClinicPeriod, mPeriod)
'error catching
If Not IsError(TotalClinicVolume) Then
a23 = a23 / TotalClinicVolume
Worksheets("CCM Analysis by Period").Range("A23").Value = a23
Else
Worksheets("CCM Analysis by Period").Range("A23").Value = 0
MsgBox "No patient yet from all three clinics."
End If
error is on the one below a23 = a23 / totalclinicvolume.
Any thoughts?