Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old October 11th, 2005, 11:56 AM
Authorized User
 
Join Date: Jun 2005
Location: Buxton, OR, USA.
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default Excel Formula End Range Changes when Macro Is Run

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

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Formula End Range Changes when Macro Is Run maaron Beginning VB 6 0 October 11th, 2005 11:33 AM
Run macro when exit/close excel dgilford Excel VBA 1 September 8th, 2005 03:42 AM
Cell returns its own formula after a macro! timoma Excel VBA 2 December 19th, 2004 03:48 PM
CurrentArray Range in Formula pagates Excel VBA 1 October 5th, 2004 04:53 AM
Error setting Formula Array property for a Range arnowitz Excel VBA 2 February 5th, 2004 02:08 PM



All times are GMT -4. The time now is 04:25 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.