+ Reply to Thread
Results 1 to 10 of 10

coding to add values until a certain limit

Hybrid View

  1. #1
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: coding to add values until a certain limit

    No problem...

    i=0
    While Sum=<Budget And i<10000
      sum=sum+sheet1.Cells(i+2,3).Value
      for cellloop=1 to 3
        sheet2.cells(i+2,cellloop).value=sheet1.cells(i+2,cellloop)
      next cellloop
      i=i+1
    wend
    Try that.

  2. #2
    Forum Contributor
    Join Date
    08-04-2010
    Location
    singapore
    MS-Off Ver
    Excel 2007
    Posts
    143

    Re: coding to add values until a certain limit

    its perfect btw using this coding will result in the total cost of items more than budget. so i came up with this "sheet2.cells(i+2,cellloop).delete" to delete the last item. however, it is not working. do u know what is wrong?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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