Sub Forecast() Dim Taeller As Single Dim Forecast As Integer Dim Stock As Integer Dim StockRest As Integer Stock = Range("B47").Value StockRest = Stock Taeller = 2 While Cells(46, Taeller).Value <= StockRest Forecast = Forecast + Cells(46, Taeller).Value StockRest = StockRest - Cells(46, Taeller).Value Taeller = Taeller + 1 Wend Range("B48").Value = Taeller End Sub
Sub Forecast() Dim Taeller As Single Dim Forecast As Integer Dim Stock As Integer Dim StockRest As Integer Stock = Range("B47").Value StockRest = Stock Taeller = 2 While Cells(46, Taeller).Value <= StockRest And Taeller < 256 Forecast = Forecast + Cells(46, Taeller).Value StockRest = StockRest - Cells(46, Taeller).Value Taeller = Taeller + 1 Wend Range("B48").Value = Taeller End Sub
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.