View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip[_3_] Chip[_3_] is offline
external usenet poster
 
Posts: 133
Default Looping w/calculation

Here you go:


Dim Months As Integer
Dim x As Integer
On Error GoTo Oops
Months = InputBox("Enter the number of MONTHS USAGE importing for
the as400: Select between 1 and 12 months!")
If Months 12 Then
MsgBox "Selection is out of Range...aborting!"
Exit Sub
End If


'Calc Min Max


Range("E2").Select

Do Until IsEmpty(ActiveCell)


x = ActiveCell.Value

'Max28

ActiveCell.Offset(0, 3).Value = ((x / (Months * 30) * 28))
'Max14
ActiveCell.Offset(0, 4).Value = ((x / (Months * 30)) * 14)
'Min7
ActiveCell.Offset(0, 5).Value = (x / (Months * 30)) * 7

ActiveCell.Offset(1, 0).Select


Loop