I have a formula when I run the
VB marco the end range reduces by 1000.
Example: Before I run the
VB macro.
"=SUMPRODUCT(--(TestingDetail!L2:L2834<=TODAY()),--(TestingDetail!A2:A2834=A3))"
Example: After I run the
VB macro.
"=SUMPRODUCT(--(TestingDetail!L2:L1834<=TODAY()),--(TestingDetail!A2:A1834=A3))"
I get the data in Sheet TestingDetails from an SQL query from my database.
zConnectionString = _
"Provider=SQLOLEDB.1;Password=xxxxxxx;Persist Security Info=True;" + _
"User ID=xxxx;Initial Catalog=SarbOxPortalV12;Data Source=someserver02;"
zSQL = "select DISTINCT ProcBusCycl, OrgUnitName, ProcName,CntrlName,CntrlSignif, TestName, DocTitle, TestDesc, TestStatus, TestResultSum, TestTester, TestEndDate, TestCmpltStatus, CntrlType2, RTRIM(LTRIM(LEFT(CntrlName, CHARINDEX(';',CntrlName)+1))) As cName from ObjSrchTypViewProcRskMatTstDtls Where OrgUnitName NOT LIKE '%xxxxx%'And TestType IN ('P - Annual Test ')ORDER BY CntrlName"
Set zConnection = New ADODB.Connection
zConnection.ConnectionString = zConnectionString
zConnection.Open
Set zRecordset = New ADODB.Recordset
zRecordset.CursorLocation = CursorLocationEnum.adUseClient
zRecordset.CursorType = CursorTypeEnum.adOpenStatic
zRecordset.LockType = LockTypeEnum.adLockBatchOptimistic
Call zRecordset.Open(zSQL, zConnection, , , CommandTypeEnum.adCmdText)
Call Sheet3.Range("A2").CopyFromRecordset(zRecordset)
Set zRecordset.ActiveConnection = Nothing
Set zConnection = Nothing