+ Reply to Thread
Results 1 to 3 of 3

summing data writen by a excel vba form

  1. #1
    Registered User
    Join Date
    02-17-2008
    Posts
    2

    summing data writen by a excel vba form

    Hi
    I am just beginning to venture into the world of vba.
    I have a form that writes to an excel spreadsheet. Within the
    worksheet I am not able to sum the values in a column after they
    have been writen by the form. I would like to have the total of the column
    calculated as items are added to the spreadsheet.
    Does anyone have any suggestions.

    Regards,
    Frank

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885
    Hi FrankCF,

    When you're writing the data to the worksheet from the Form, are you inserting the data as text values rather than numeric?

    When you use =sum(a1:a10) on text values, even numbers as text, you'll get 0. If you used =a1+a2...+a10 it would actually return the correct number.

    The best option would probably be to have your vba write the data as numeric to begin with, e.g.
    Please Login or Register  to view this content.
    ALSO: Make sure the cells you're writing to aren't already formatted as Text.
    Last edited by Paul; 02-17-2008 at 05:50 PM.

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    A TextBox by default enters Text. I would always use NumberFormat

    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1