+ Reply to Thread
Results 1 to 12 of 12

Change cell value +1 or -1

  1. #1
    Forum Contributor aaaaa34's Avatar
    Join Date
    12-25-2013
    Location
    Istanbul
    MS-Off Ver
    Windows 10, MS Office 2013
    Posts
    375

    Change cell value +1 or -1

    Hey my friends,
    I'd like to get two VBA codes to increase and decrease the value in cell A1 one by one.
    If A1 value is 23, when I run "increase VBA", A1 should be 24. or if I click to run "decrease VBA" , it should be 22. and so on. Also it should continue to run. I mean, If I click to run "decrease VBA" three times in a row, cell value should be 20.
    Can you help me with it please? Thank you.

  2. #2
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Change cell value +1 or -1

    Hi aaaaa34,

    Assuming the buttons are on the same sheet as the A1 value (otherwise the sheet needs to be referenced in the code):

    Please Login or Register  to view this content.
    I've put in the check for A1 being numeric to avoid any errors.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  3. #3
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: Change cell value +1 or -1

    Please Login or Register  to view this content.
    Attached Files Attached Files

  4. #4
    Forum Contributor aaaaa34's Avatar
    Join Date
    12-25-2013
    Location
    Istanbul
    MS-Off Ver
    Windows 10, MS Office 2013
    Posts
    375

    Re: Change cell value +1 or -1

    Quote Originally Posted by nigelog View Post
    .
    Thank you so much for your fast response bro.
    I want to ask you that f i want to run this code for E5 cell for example, how I should modify these "Cells(1, 1).Value = Cells(1, 1).Value + 1"

  5. #5
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Change cell value +1 or -1

    Well you could use Range instead of Cells if that makes it easier (see my post) or just edit Cells(1,1) to Cells(5,5). The syntax for "Cells" is (row number, column number)

  6. #6
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: Change cell value +1 or -1

    As Arkadi said - change to either
    Please Login or Register  to view this content.
    or
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor aaaaa34's Avatar
    Join Date
    12-25-2013
    Location
    Istanbul
    MS-Off Ver
    Windows 10, MS Office 2013
    Posts
    375

    Re: Change cell value +1 or -1

    Oke nigel de jong. Now i got it.
    arkadiusz milik, thank you so much too for post #2. It works great.
    both of your names reminded me these players : )

    I want to use your codes with some modifications.
    Thank you.
    Last edited by aaaaa34; 06-14-2019 at 10:10 AM. Reason: I will submit my request in new thread.

  8. #8
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: Change cell value +1 or -1

    That is a different question and should be the subject of a new thread. Other participants may get involved to help find your answer if you do. If this first question has been answered then please mark thread as solved and start with a new thread with an accurate description of what you are hoping to achieve. Rgds

  9. #9
    Forum Contributor aaaaa34's Avatar
    Join Date
    12-25-2013
    Location
    Istanbul
    MS-Off Ver
    Windows 10, MS Office 2013
    Posts
    375

    Re: Change cell value +1 or -1

    oke nigel.
    If Arkadi doesn't want to reply here too, I will open a new thread.
    Now I mark this thread solved so fast. Thank you.

  10. #10
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Change cell value +1 or -1

    aaaaa34, nigel was right that it is a different request, and since he already asked for a new thread to be created, I will respect that. Happy to help if you start a new one though

    p.s. I guess you are a big soccer fan?

  11. #11
    Forum Contributor aaaaa34's Avatar
    Join Date
    12-25-2013
    Location
    Istanbul
    MS-Off Ver
    Windows 10, MS Office 2013
    Posts
    375

    Re: Change cell value +1 or -1

    off course I love soccer a lot and follow all european soccer leagues.
    Arkadiusz Milik, plays for Napoli, not big star like Lewandowski, but very talented and they score a lot together for Poland : ))))

  12. #12
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Change cell value +1 or -1

    Cool
    Once you start a new thread for the new question about max/min restrictions, I can give you some code for that.

+ 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. [SOLVED] If one cell is greater than another, change fill color of other cells. If not, no change
    By nighttrain20 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 12-19-2018, 10:08 AM
  2. Replies: 1
    Last Post: 11-06-2015, 08:02 AM
  3. If range value change, active cell equal date and time of change.
    By kmakjop in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-31-2015, 02:43 PM
  4. Change the content of a cell based on change the current date
    By aimanraya in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-14-2014, 07:07 AM
  5. Replies: 2
    Last Post: 06-11-2012, 07:30 PM
  6. auto change cell formula on condition of worksheet change in other cells
    By futurejock in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-01-2009, 12:11 AM
  7. [SOLVED] Cell value change to trigger macro (worksheet change event?)
    By Neil Goldwasser in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-10-2006, 10:00 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