+ Reply to Thread
Results 1 to 7 of 7

Using a Form Button to add 1 to a cell each time it is clicked

  1. #1
    Registered User
    Join Date
    06-02-2010
    Location
    Melbourne
    MS-Off Ver
    Excel 2007
    Posts
    96

    Using a Form Button to add 1 to a cell each time it is clicked

    Hi all,

    Ill start with the circumstance. I have a spreadsheet where there are multiple form buttons.
    For this example Ill use one because I beleive I will be able to extrapolate the formula to the others.

    I have one form button named "Small Latte", when it is clicked I would like to add one to the value of cell F4

    Currently I am using the formula
    Please Login or Register  to view this content.

    I get the error: Run-time error '1004': Method 'Range' of object '_Global' failed

    I think its telling me that its empty, F4 has a value of 0 and I want it to stay at 0 until the button is clicked

    Is there anything I can do to get this working?

    I would greatly appreciate any help.

    Cheers
    Last edited by royUK; 08-14-2010 at 02:59 AM. Reason: add code tags

  2. #2
    Registered User
    Join Date
    06-02-2010
    Location
    Melbourne
    MS-Off Ver
    Excel 2007
    Posts
    96

    Re: Using a Form Button to add 1 to a cell each time it is clicked

    If its relevant in any way I though I should mention the sheet's name is Today

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Using a Form Button to add 1 to a cell each time it is clicked

    The code should work fine, though the selection is not necessary; post a workbook if you can, after editing your post to add CODE tags.
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Registered User
    Join Date
    06-02-2010
    Location
    Melbourne
    MS-Off Ver
    Excel 2007
    Posts
    96

    Re: Using a Form Button to add 1 to a cell each time it is clicked

    When im in the macro coding section, the line Range(F4).. is highlighted in yellow and when i place the cursor over the f4 it brings up at note saying F4 = empty?

    I have attached the workbook becasue I am unsure of how to fix it.

    Cheers
    Attached Files Attached Files

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Using a Form Button to add 1 to a cell each time it is clicked

    You need speech marks around the range references
    Please Login or Register  to view this content.
    Also, please use Code Tags in future
    Hope that helps.

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

    Free DataBaseForm example

  6. #6
    Registered User
    Join Date
    06-02-2010
    Location
    Melbourne
    MS-Off Ver
    Excel 2007
    Posts
    96

    Re: Using a Form Button to add 1 to a cell each time it is clicked

    thankyou very much that did the trick

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Using a Form Button to add 1 to a cell each time it is clicked

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ 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