+ Reply to Thread
Results 1 to 12 of 12

Increment values 1 by 1 and refresh columns automatically

  1. #1
    Registered User
    Join Date
    11-16-2018
    Location
    Germany
    MS-Off Ver
    2016
    Posts
    20

    Increment values 1 by 1 and refresh columns automatically

    Hi all,

    EXCEL QUESTION.png

    -ONLY M3 matters. The rest of column M and N are IRRELEVANT.
    In this example, for M3=120 I would like the following to happen automatically:
    -Column K is filled starting from K3=0 till K123=M3=120 (K4=1, K4=2, K5=3, etc.);
    -Column L is filled starting from L3=100000 till L123=L3=100000; (L"y"=L3);

    M3 is a variable value >0.

    This is the Macro I'm trying to use for the column K:

    Sub Increment_Macro()

    Dim i As Integer, j As Integer
    i = 4
    j = 11
    Do Until i < whatsinthecell = Worksheets("AidCalc1").Range("M3").Value
    Cells(i, j).Value = whatsinthecell = Worksheets("AidCalc1").Range("K3").Value
    i = i + 1
    Loop

    End Sub


    This is what I get:
    result.PNG

    QUESTIONS:
    -How do I fix the Macro for column K?
    -What should the Macro be for column L?
    -The next step is to plot these columns in a line graph. How do I define the columns to be plotted since they are always different depending on the M3 input?


    Thanks in advance!

  2. #2
    Valued Forum Contributor
    Join Date
    11-28-2015
    Location
    indo
    MS-Off Ver
    2016 64 bitt
    Posts
    1,342

    Re: Increment values 1 by 1 and refresh columns automatically

    Perhab like this
    Please Login or Register  to view this content.
    Last edited by daboho; 11-20-2018 at 02:48 PM.

  3. #3
    Registered User
    Join Date
    11-16-2018
    Location
    Germany
    MS-Off Ver
    2016
    Posts
    20

    Re: Increment values 1 by 1 and refresh columns automatically

    Thanks a lot, now it's running!

    Although everytime I run the macro for a new value of M3 it opens a new sheet. Is it possible to first clean the columns $K$3:$L$(VALUE of M3+3) and then run the macro always on this sheet (AidCalc1) and introduce the values on the columns K and L?

    Also, the next step of what I want to do is to plot those 2 columns into a line graph. Any ideas on how I can do that? The range is variable so I'm not sure how to overcome that.

    Thanks a lot for your help!
    Last edited by FilipeF; 11-21-2018 at 05:12 AM.

  4. #4
    Valued Forum Contributor mohan.r1980's Avatar
    Join Date
    09-18-2010
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2010 (windows7)
    Posts
    729

    Re: Increment values 1 by 1 and refresh columns automatically

    i have a UPS Master Macro file
    find the attached file which will help you
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    11-16-2018
    Location
    Germany
    MS-Off Ver
    2016
    Posts
    20

    Re: Increment values 1 by 1 and refresh columns automatically

    Thank you once again but it's password protected.

  6. #6
    Valued Forum Contributor mohan.r1980's Avatar
    Join Date
    09-18-2010
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2010 (windows7)
    Posts
    729

    Re: Increment values 1 by 1 and refresh columns automatically

    No FilipeF its not password protected

    when you open it just enable the protection which see on top

  7. #7
    Registered User
    Join Date
    11-16-2018
    Location
    Germany
    MS-Off Ver
    2016
    Posts
    20

    Re: Increment values 1 by 1 and refresh columns automatically

    I want to view the code to adapt it to my case and, as I said, it's password protected
    passwordprotected.PNG

  8. #8
    Valued Forum Contributor
    Join Date
    11-28-2015
    Location
    indo
    MS-Off Ver
    2016 64 bitt
    Posts
    1,342
    Quote Originally Posted by FilipeF View Post
    Thanks a lot, now it's running!

    Although everytime I run the macro for a new value of M3 it opens a new sheet. Is it possible to first clean the columns $K$3:$L$(VALUE of M3+3) and then run the macro always on this sheet (AidCalc1) and introduce the values on the columns K and L?

    Also, the next step of what I want to do is to plot those 2 columns into a line graph. Any ideas on how I can do that? The range is variable so I'm not sure how to overcome that.

    Thanks a lot for your help!
    If not in other sheet

    erhab like this
    Code:
    Please Login or Register  to view this content.
    "Presh StarFor Attention * For Add Reputation!!"

  9. #9
    Valued Forum Contributor mohan.r1980's Avatar
    Join Date
    09-18-2010
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2010 (windows7)
    Posts
    729

    Re: Increment values 1 by 1 and refresh columns automatically

    ahh that have password
    ok

    i am pasting the code below
    Please Login or Register  to view this content.
    the file which i provided is for ups only.
    In your case if you put 120 in B column and "ABC" In Column A then macro will repeat "ABC" 120 times
    anyway i am working on your question. let me have some time

  10. #10
    Registered User
    Join Date
    11-16-2018
    Location
    Germany
    MS-Off Ver
    2016
    Posts
    20

    Re: Increment values 1 by 1 and refresh columns automatically

    Minor detail: As shown in the image I have other stuff on the sheet. Is it possible to just clear the columns $K$3:$L$(VALUE of M3+3)?
    More significant observation: Whether I run the macro on this sheet or not, the same issue with the graph plotting stands. How do I plot a line graph with a variable range? (M3 is a variable value>0)
    Capture.PNG
    Once again, Thank you!
    Last edited by FilipeF; 11-21-2018 at 07:10 AM.

  11. #11
    Valued Forum Contributor mohan.r1980's Avatar
    Join Date
    09-18-2010
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2010 (windows7)
    Posts
    729

    Re: Increment values 1 by 1 and refresh columns automatically

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

  12. #12
    Registered User
    Join Date
    11-16-2018
    Location
    Germany
    MS-Off Ver
    2016
    Posts
    20

    Re: Increment values 1 by 1 and refresh columns automatically

    Minor detail: As shown in the image I have other stuff on the sheet. Is it possible to just clear the columns $K$3:$L$(VALUE of M3+3) instead of the whole sheet?
    More significant observation: Whether I run the macro on this sheet or not, the same issue with the graph plotting stands. How do I plot a line graph with a variable range? (M3 is a variable value>0)

    Before running the macro:
    Attachment 598936

    After running the macro:
    Attachment 598937
    Once again, Thank you!

+ 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: 3
    Last Post: 04-25-2017, 04:57 PM
  2. Automatically increment worksheet numbers
    By sdaddy in forum Excel General
    Replies: 18
    Last Post: 11-18-2015, 06:02 AM
  3. How to refresh multiple sheet automatically and save it as values
    By cool_anu4u in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-12-2014, 05:12 PM
  4. [SOLVED] Automatically increment to next number after 55 rows
    By sagar007 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-02-2013, 06:56 AM
  5. Automatically increment formula automatically
    By Brianboy_24 in forum Excel General
    Replies: 1
    Last Post: 08-27-2010, 09:35 PM
  6. Increment cells automatically
    By cagedmonkees in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-19-2010, 08:07 PM
  7. automatically increment field by one
    By Dingbat in forum Excel General
    Replies: 2
    Last Post: 10-25-2005, 04:05 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