+ Reply to Thread
Results 1 to 4 of 4

Change one number in a cell inside a formula to a variable that is getting higher (+1)

  1. #1
    Registered User
    Join Date
    10-06-2015
    Location
    Kleve
    MS-Off Ver
    2010
    Posts
    5

    Change one number in a cell inside a formula to a variable that is getting higher (+1)

    Hey everyone,
    I'm new to this forum as well as I'm new to the world of vba /macros. My name is malte, I'm a student of agribusiness in germany and currently i'm working on a project
    where i need to evalute 2700 sets of data (diet quality in uganda/africa). This is how I experienced the wonderful functions of excel macro programming.
    I already created a method to save 90% of our time using the macros but now I'm keen to optimize the progress and save even more time. I'd like to apologize
    before if I write facts about my case in the wrong way or just not understandable. I'm new to this world and my knowledge is quite limited. Every kind of advise is appreciated!

    The Problem
    I got wto tables with sets of data and they need to get multiplied in a certain way (every row in tab1 has to be multiplied with every value in tab2. then i need to get the sum of every row in tab2. these sums are results that i want to get for every set of data (=every row in tab1). the sums therefor have to get copied into another tab4. once this is done i can start to evalue the next row in tab1.
    This is my macro:
    Please Login or Register  to view this content.
    In my current situation i always need to change only one number in the first cell of my calculation table tab3 to get the next row in tab1. the rest is done my the macro above. I'm now searching for a way to change this number for a variable that is getting +1 higher every time and then restarts the macro as a loop until reaching "2700" which is my last row to evaluate.

    Here is another macro that could be linked with the first one:

    Please Login or Register  to view this content.
    is the number that needs to get +1 higher every time to get another row in Sheet1 (=tab1)

    Is it possible to change it for a variable that is defined to get higher and doing a loop until reaching the value of 2700 =

    I would be really grateful for any kind of help!

    Kind regards,
    Malte
    Last edited by chablo309; 10-13-2015 at 08:57 AM.

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,613

    Re: Change one number in a cell inside a formula to a variable that is getting higher (+1)

    Hi Malte,

    As I understood, you want to change the formula in D5 from
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    to
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    etc.
    and after each change run Macro1.

    If that is right, try:

    Please Login or Register  to view this content.
    PS. Please spend some time reading http://www.excelforum.com/forum-rule...rum-rules.html and edit your first post using code tags (as it is explained in the rules)
    Best Regards,

    Kaper

  3. #3
    Registered User
    Join Date
    10-06-2015
    Location
    Kleve
    MS-Off Ver
    2010
    Posts
    5

    Re: Change one number in a cell inside a formula to a variable that is getting higher (+1)

    Dear Kaper,
    You're suggestion works perfectly fine. Thanks a lot for helping me as well as the advise about how to use the forum in a appropriate and effective way. I'll try my best to follow the rules next time!

    Kind regards,
    Malte

  4. #4
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,613

    Re: Change one number in a cell inside a formula to a variable that is getting higher (+1)

    Hi,

    Glad it worked and thanks for reputation and for marking thread as "solved".
    Would be lovely if you edit your first post (look just below it - there is a small pencil - "Edit post" icon) and use code tags. Just as a training :-D .

+ 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] Need to change the caption of various labels inside a userform with a variable
    By navialivad in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-19-2014, 03:02 PM
  2. Replies: 13
    Last Post: 08-13-2013, 12:51 PM
  3. Replies: 4
    Last Post: 09-16-2011, 09:28 AM
  4. How to change code's limit 65536 to higher possible number
    By wali in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-12-2010, 12:00 PM
  5. Replies: 7
    Last Post: 03-22-2010, 05:22 PM
  6. Change Cell Ref inside a formula
    By dht in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-04-2006, 06:20 PM
  7. How do I change z-axis value from zero to a higher number (eg 4)?
    By cscharl in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 01-19-2005, 04:06 PM

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