+ Reply to Thread
Results 1 to 4 of 4

Creating loop using a cell value as the maximum limit

  1. #1
    Registered User
    Join Date
    07-09-2014
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    4

    Creating loop using a cell value as the maximum limit

    I have extracted the maximum integer value from my data set into cell V20.

    On Sheet 3, I would like to have the A column populated by all the integers from 1 to this maximum value (which in this case is 19).

    Whilst this would be easy enough just to drag out, I have to do it for many different workbooks, so a simple VBA loop would be really helpful!

    Along the lines of:

    For i=1 to V20

    Cells(i,1).Value = i

    End

    Thanks

  2. #2
    Registered User
    Join Date
    09-10-2014
    Location
    Matrix
    MS-Off Ver
    2010
    Posts
    70

    Re: Creating loop using a cell value as the maximum limit

    Please Login or Register  to view this content.
    (*) Reputation points appreciated.
    excelbs.tk

  3. #3
    Registered User
    Join Date
    07-09-2014
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Creating loop using a cell value as the maximum limit

    Thank you for the quick reply! I am still totally new to VBA, and when I try to run/play the code, I get a 'run-time error type mismatch' message. I have changed cells(i,1) to cells(i,13) so that it fills the M column, but otherwise I have copied your code line for line - any suggestions what's happening?

  4. #4
    Registered User
    Join Date
    07-09-2014
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Creating loop using a cell value as the maximum limit

    No matter, all fixed - silly mistake. Thanks again!

+ 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. the maximum and minimum limit
    By madhupangal in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 12-07-2015, 05:49 PM
  2. This won't delete
    By hnidan in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-17-2012, 04:11 PM
  3. Formula to limit maximum value
    By Lunar in forum Excel General
    Replies: 3
    Last Post: 01-27-2012, 03:54 AM
  4. formula to limit maximum value
    By tomco11ins in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-13-2011, 11:34 PM
  5. Replies: 8
    Last Post: 10-14-2010, 08:24 AM
  6. Change Maximum Limit of Characters in Cell
    By Newton1234 in forum Excel General
    Replies: 9
    Last Post: 08-12-2010, 08:04 PM
  7. Limit SUM Maximum
    By gkkes in forum Excel General
    Replies: 6
    Last Post: 06-16-2010, 01:21 AM
  8. custom data validation formula to limit cell value to maximum of 4 decimal places
    By wotadude in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-05-2009, 04:42 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