+ Reply to Thread
Results 1 to 7 of 7

Increase/Decrease values by 1, Range 1-80, No repeating value

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

    Increase/Decrease values by 1, Range 1-80, No repeating value

    Hello again mates,
    I'd like to get two VBA codes in one worksheet for creating two-number or more-number sets.
    A1=5
    B1= empty or given value else 5

    code1
    It will start to increase B1 value one by one from 1 to 80
    While increasing, when it comes to 5, it should skip it, bcuz I dont want to enter repeating value with cell A1.
    code2
    It will start to decrease B1 value one by one from 1 to 80
    While decreasing, when it comes to 5, it should skip it, bcuz I dont want to enter repeating value with cell A1.
    Note
    If B1 is empty and code1 should start giving values from 1. If B1 is empty code2 should start giving values like 80,79,78,... So on.
    If B1 has already value, such as 4, code1 should continue to increase like 6, 7, 8,... so on.
    If B1 has already value, such as 6, code2 should continue to decrease like 4, 3, 2, 1, 80, 79, 78......

    Please check it to see.
    Thank you.
    Last edited by aaaaa34; 06-14-2019 at 12:14 PM. Reason: explanations added

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,890

    Re: Increase/Decrease values by 1, Range 1-80, No repeating value

    Sorry for off-topic interjection:

    Although there is no official rule regarding this behavior, we request that wherever possible both the question AND the answer be provided in substantive detail here within the thread. An attached workbook is an excellent aid for posing a question and offering a solution, but solely doing that with no in thread explanation makes it difficult for researchers to understand or consider the Q & A of this thread without downloading what may be a pointless doc to them, if they can do that at all. Doing that also hides the content from search engines so others may never benefit from this.

    I'm sure you understand, and we look forward to seeing you post your formulas/macros in your posts for the searching benefit of all.

    Thanks again for all your hard work here!
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

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

    Re: Increase/Decrease values by 1, Range 1-80, No repeating value

    Hi again aaaaa34,

    It would be great if you can edit your original post to add the explanation from inside the file (can copy paste so it is easy). That way others who search in the future may get better results. That said, since alan did not say we should not answer until you change it, here are the codes I put together (hope I understood correctly).

    Please Login or Register  to view this content.
    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.

  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: Increase/Decrease values by 1, Range 1-80, No repeating value

    Arkadi, code super, it is working perfectly.
    Thank you so much.
    How can we edit these two codes for creating three-number sets? Again, number range is 1-80. Also, both A1 and B1 values will not be repeated.

    Rules:

    Both two codes will run to give values C1

    code1 - Increase
    It will start to increase one by one from 1 to 80
    While increasing, when it comes to 3 and 77, it should skip it, bcuz I dont want to enter repeating value with cell A1 and B1.
    code2 - Decrease
    It will start to decrease one by one from 1 to 80
    While decreasing, when it comes to 3 and 77, it should skip it, bcuz I dont want to enter repeating value with cell A1 and B1.
    Note:
    If C1 is empty and code1 should start giving values as 1,2,4,5......so on. If C1 is empty code2 should start giving values as 80,79,78, 76,75... So on.
    If C1 has already value, such as 2, code1 should continue to give values as 4, 5, 6,... so on.
    If C1 has already value, such as 4, code2 should continue to give values as 2, 1, 80, 79, 78, 76, 75...so on.

    Pls check attached file.

  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: Increase/Decrease values by 1, Range 1-80, No repeating value

    Give these a try:

    Please Login or Register  to view this content.

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

    Re: Increase/Decrease values by 1, Range 1-80, No repeating value

    Perfecto
    Muchas gracias Milik!!!

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

    Re: Increase/Decrease values by 1, Range 1-80, No repeating value

    Thanks for the feedback and rep, as well as marking the thread as solved

+ 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. Replies: 1
    Last Post: 03-30-2015, 03:10 PM
  2. Percentage Increase/Decrease formula for all values including 0
    By loz2289 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-10-2012, 12:16 PM
  3. Replies: 3
    Last Post: 09-18-2012, 01:01 AM
  4. Replies: 1
    Last Post: 06-22-2010, 11:14 AM
  5. Increase/Decrease Print Range in Macro
    By tariqnaz2005 in forum Excel General
    Replies: 4
    Last Post: 11-11-2009, 08:55 AM
  6. How to increase/decrease values individually?
    By gergerger in forum Excel General
    Replies: 2
    Last Post: 10-13-2008, 02:01 PM
  7. Range to increase/decrease with data
    By JohnUK in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-26-2006, 06:55 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