Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Beginning VB 6
Password Reminder
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 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
Thread Tools Display Modes
  #1 (permalink)  
Old October 11th, 2005, 11:33 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.

Example: After I run the VB macro.

I get the data in Sheet TestingDetails from an SQL query from my database.
zConnectionString = _
"Provider=SQLOLEDB.1;Password=$arb0x$ql;Persis t Security Info=True;" + _
"User ID=Sarboxuser;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 '%intel%'And TestType IN ('P - Annual Test ')ORDER BY CntrlName"
    Set zConnection = New ADODB.Connection
    zConnection.ConnectionString = zConnectionString
    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

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 Excel VBA 0 October 11th, 2005 11:56 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 08:18 PM.

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