+ Reply to Thread
Results 1 to 13 of 13

HOW to Post formula in to Excel sheet (cell)

  1. #1
    Registered User
    Join Date
    04-23-2013
    Location
    Jordan
    MS-Off Ver
    Excel 2010
    Posts
    77

    HOW to Post formula in to Excel sheet (cell)

    I want to the textbox to post a formula in a cell
    lets say (G6=E6-F6+G5) but each time I post the textbox to the next row , the formula will change to be to the next value (G7=E7-F7+G6)

    Any Idea ???
    Last edited by Shacker; 04-28-2013 at 01:53 AM.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Calculating formula

    Iin accordance with forum rules, please rename your thread to something more meaningful, that actually describes your problem.

    Because thread titles are used in searching the forum it is vital they be written to accurately describe your thread content or overall objective using ONLY search friendly key words. That is, your title used as search terms would return relevant results.

    Many members will look at a thread title, and if it is of interest to them, or it falls within their area of expertise, they might only open those threads.

    Look at it this way...if you typed that title into google, what would you expect to get back?
    To change a Title on your post, click EDIT on you're 1st post, then Go Advanced and change your title
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    04-23-2013
    Location
    Jordan
    MS-Off Ver
    Excel 2010
    Posts
    77

    Re: HOW to Post formula in to Excel sheet (cell)

    Done
    hope its ok now (Y)

  4. #4
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,429

    Re: HOW to Post formula in to Excel sheet (cell)

    The easiest, to me anyway, would seem to be to write the formula into the cell (using relative references), then simply copy/paste drag/fill down. http://office.microsoft.com/en-us/ex...979.aspx?CTT=1

    Since this is in the VBA forum, I'm guessing that is not what you want. To write a formula to a cell/range, you can use the formula property of the range object. http://msdn.microsoft.com/en-us/libr...ice.10%29.aspx The formula property is a text string, so changes like you are describing would require you to use VBA's text functions/operators (the concatenate operator & in particular) to build the text string, then write it to the formula property.

    Easier would be to use R1C1 notation, http://msdn.microsoft.com/en-us/libr...ice.10%29.aspx because the text string for a formula in R1C1 notation doesn't change. See "reference styles" here http://office.microsoft.com/en-us/ex...997.aspx?CTT=1 for a description of how R1C1 references work.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645
    Just copy the formula down.

    If there's no formula to copy down it should be quite easya to figure out the row references to use.
    If posting code please use code tags, see here.

  6. #6
    Registered User
    Join Date
    04-23-2013
    Location
    Jordan
    MS-Off Ver
    Excel 2010
    Posts
    77

    Re: HOW to Post formula in to Excel sheet (cell)

    that is correct , but I am using the code that sends the data from the userform to the last line . if I copied the cells down , the data will not be sent to the last used line correctly ...

    I need that coz I am using the search in the sheet that will pulls the row with the last column as balance

    All-Transaction Sheet
    -----column A -----|-----column B -----|-----column C ------|-----column D-----|-----column E-----|
    Description | Date | Credit Amount | Debit Amount | Balance |
    Invoice # 50 | 04/22/2013 | | 1500.00 | 1500.00 |
    Payment # 2 | 04/22/2013 | 1000.00 | | 500.00 |

    if I used the copy and past formula in the sheet , I cant send my userform data to the correct fir empty line
    if when I use the search code , I get this report without the value in Column E

    I believe that , when sending the userform data to the All-Transaction Sheet I must include the formula in the sendtext option ...

    Any Other Suggestions ?

    this is the code I'm using now

    Please Login or Register  to view this content.
    Last edited by Shacker; 04-28-2013 at 10:49 AM.

  7. #7
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,429

    Re: HOW to Post formula in to Excel sheet (cell)

    Now we begin to see some of the complexities in your problem.
    if I used the copy and past formula in the sheet , I cant send my userform data to the correct fir empty line
    Since I never use userforms, I'll have to take your word for it that something about using the userform prevents you from copying/pasting a formula down. Since I never use userforms, I don't know if I'll be able to be any real help.

    Sometimes when I do this, I "pre-copy" the formula down, then the formula is already in place as data is filled in. I do realize that this creates a column of 0's (0-0+0=0), but the person I program spreadsheets for does not care if there is a column of 0's. He knows that the formula will compute as data is filled in. I recognize that many users cannot stand to see a column of 0's before the data are entered.

  8. #8
    Registered User
    Join Date
    04-23-2013
    Location
    Jordan
    MS-Off Ver
    Excel 2010
    Posts
    77

    Re: HOW to Post formula in to Excel sheet (cell)

    I found this code , but don't know how to figure it out to do my needs !!!

    Please Login or Register  to view this content.

  9. #9
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: HOW to Post formula in to Excel sheet (cell)

    Sorry you've really lost me.

    There's nothing stopping you putting the values from the textboxes in the right cells and copying the formula down.

    Also, there's nothing stopping you doing the calculation in code rather than using a formula.

    By the way, that last code would be only work if you had a named range called 'Database', do you?

  10. #10
    Registered User
    Join Date
    04-23-2013
    Location
    Jordan
    MS-Off Ver
    Excel 2010
    Posts
    77

    Re: HOW to Post formula in to Excel sheet (cell)

    yes Sir, the sheet I am working on as a test called "Database"
    balance error.jpg

    at the same time I am working at a similar sheet called "AllTrans" ...
    when copying the formula in the sheet as per attached image its not giving the correct balance
    plz check

  11. #11
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: HOW to Post formula in to Excel sheet (cell)

    Pictures aren't that helpful with this sort of thing, though this one does now tell me you are using a ListView.

    One thought I had was that you should perhaps separate things a bit.

    Rather than trying to do everything at the same time work on one part, posting data to 'InvoiceClac'.

    Then and once that's working fine work on the next part, posting data to 'AllReceipts'.

  12. #12
    Registered User
    Join Date
    04-23-2013
    Location
    Jordan
    MS-Off Ver
    Excel 2010
    Posts
    77

    Re: HOW to Post formula in to Excel sheet (cell)

    The code has no problem in posting to any sheet or cell ...
    all are working fine .. except the list view sum !!!!

  13. #13
    Registered User
    Join Date
    04-23-2013
    Location
    Jordan
    MS-Off Ver
    Excel 2010
    Posts
    77

    Re: HOW to Post formula in to Excel sheet (cell)

    you were right , let the sheet make the calculation

    thank you

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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