+ Reply to Thread
Results 1 to 6 of 6

making action buttons to add and subtract cells

  1. #1
    Registered User
    Join Date
    12-19-2013
    Location
    Israel
    MS-Off Ver
    Excel 2010
    Posts
    3

    making action buttons to add and subtract cells

    Hi, I am new to macros, and have no background in VB, I do have some C+ and pascal skills, so I probably can learn fast.

    what I am trying to do is this :
    Cell A1 has a number (ex 40)
    Cell B1 has a number (ex 32)
    Cell C1 has a number (7)
    Cell D1 has a number (2)
    Cell E1 has a number (9)

    I need four buttons :
    "button 1" should work only if D1>0 and should subtract 1 from D1 and add E1 to B1 up to the maximum of A1 (if the addition would bring B1 higher then A1 make B1 equal A1)
    "button 2" should ask for a number and subtract that number from B1 down to a minimum of half A1 (if the subtraction would bring B1 to lower than A1/2 then make B1 equal A1/2)
    "button 3" should ask for a number and add that number to B1 up to the maximum of A1 (if the addition would bring B1 higher then A1 make B1 equal A1)
    "button 4" should make D1 equal to C1 and do the same for D2=C2 D3=C3 and so on.

    can anyone help me do this ? or show me a guide in which I can learn for myself ?
    thanks a lot !

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: making action buttons to add and subtract cells

    1)
    Please Login or Register  to view this content.
    Hope this helps

    Sometimes its best to start at the beginning and learn VBA & Excel.

    Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
    Available for remote consultancy work PM me

  3. #3
    Registered User
    Join Date
    12-19-2013
    Location
    Israel
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: making action buttons to add and subtract cells

    thanks !

    I created a module and copied this to it,
    but when I create a button it doesnt let me choose the module to attach to the button.
    can you help with how to use this ?

  4. #4
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,028

    Re: making action buttons to add and subtract cells

    maybe
    Please Login or Register  to view this content.
    Regards, John55
    If you have issues with Code I've provided, I appreciate your feedback.
    In the event Code provided resolves your issue, please mark your Thread as SOLVED.
    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

    ...enjoy -funny parrots-

  5. #5
    Registered User
    Join Date
    12-19-2013
    Location
    Israel
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: making action buttons to add and subtract cells

    thank you both ! that worked
    now all I need is the function for recieving a number from the user and using it,
    and a function that gives a random number between 1-6

  6. #6
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: making action buttons to add and subtract cells

    randomnumber = Int ((6 - 1 + 1) * Rnd + 1)

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Password protection for action buttons
    By Mearsy in forum Excel General
    Replies: 2
    Last Post: 11-15-2012, 11:12 AM
  2. add/subtract using action button
    By Baziwan in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 11-12-2012, 02:49 AM
  3. Replies: 2
    Last Post: 06-22-2009, 06:08 PM
  4. [SOLVED] how do I add action buttons in excel
    By kuhac in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-26-2006, 09:12 PM
  5. Changing color of action buttons
    By AndyOne in forum Excel General
    Replies: 2
    Last Post: 03-03-2005, 10:28 AM

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