Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 14th, 2005, 09:57 AM
Authorized User
 
Join Date: Dec 2004
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default Adding numbers

Hi

I import figures from access on a monthly basis. I import a varying number of figures into col B of an excel spreadsheet. I want to automatically add these numbers when a button is pressed and then link the sum into another sheet. Can anyone point me in the right direction?



Cheers
Tony
__________________
Cheers
Tony
 
Old March 14th, 2005, 01:19 PM
Authorized User
 
Join Date: Feb 2005
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
Default

u could try record a macro and do this: Data > Import External Data, follow the steps, and stop the macro recording.

Look at your code , and ajust things if necesarry
 
Old November 18th, 2005, 06:19 AM
Authorized User
 
Join Date: Oct 2004
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to shattered Send a message via Yahoo to shattered
Default

Function CheckDataForRange(sSheet As String) As Double
dRow = 0
dTotal = 0
Do
    dRow = dRow + 1
    dTotal = dTotal + Sheets(sSheet).Cells(dRow, 2).Value
Loop Until IsEmpty(Sheets(sSheet).Cells(dRow, 2).Value)
CheckDataForRange = dTotal
End Function

that function will total the column data for you and return a value, which you can then paste into the other sheet

 
Old November 23rd, 2005, 03:02 AM
Authorized User
 
Join Date: Nov 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi,
u jus try this,
Select "B2" col and format it similarly for the varying imported data like "####.00".
u jus use "sum()" to a cell(may be usedrange's cell +1 cell) calculate the col "b2" values.
copy the calculated cell value and put it into a variable and open other sheet and paste it!.
is it works for u???
Vinod.


Regards,
VInod





Similar Threads
Thread Thread Starter Forum Replies Last Post
adding up 2 numbers in xsl umair.aziz XSLT 3 July 14th, 2006 09:24 AM
regarding adding numbers in xsl umair.aziz XSLT 1 June 24th, 2006 12:12 PM
adding numbers gmoney060 Access 1 August 15th, 2004 08:14 PM
Adding numbers kend XSLT 4 June 27th, 2003 12:33 AM
Adding numbers kend XSLT 1 June 26th, 2003 10:14 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.