Hey Mick
Its looking good now
made some modifications
Option Explicit
Sub Machine()
'Multi Cuts
Dim Cs As Single, Feed As Single, DCut As Single, oD As Single, id As Single, Lg As Single
Dim pi, Tsec As Single, Ncuts, Tot As Single, c, Last As Long
Dim rpm, TimOneRev, TotNumRevs, TotTime, CutDia, Temp
Dim Rng As Range, Dn As Range, oSum As Single
Dim Mrevs As Single
Last = Range("E" & Rows.Count).End(xlUp).Row
Last = IIf(Last > 1, Last + 1, Last)
Range("A1") = "Cutting speed Mts/Min"
Range("A2") = "Feed/Rev (mm)"
Range("A3") = "Depth of Cut (mm)"
Range("A4") = "O/D (mm)"
Range("A5") = "Finish Dia (mm)"
Range("A6") = "Length Of Cut (mm)"
Range("A7") = "Max rpm"
Range("A8") = "Total Time (sec)"
pi = Application.pi
Cs = Range("B1")
Feed = Range("B2")
DCut = Range("B3")
oD = Range("B4")
id = Range("B5")
Lg = Range("B6")
Mrevs = Range("B7")
Ncuts = (oD - id) / (2 * DCut)
'If the Total depth of cuts Divided by the Depth of cut has
'a remainder then the number of cuts is increase by one
'& the Depth of final cut reduced accordingly
If Ncuts - Int(Ncuts) <> 0 Then
Temp = (Ncuts - Int(Ncuts)) '* DCut * 2
Ncuts = Int(Ncuts) + 1
End If
For Tsec = Ncuts To 1 Step -1
c = c + 1
If Tsec = 1 And Temp <> "" Then
CutDia = oD - (2 * DCut * c) + ((DCut - (DCut * Temp)) * 2)
Else
CutDia = oD - (2 * DCut * c)
End If
rpm = (Cs * 1000) / (pi * CutDia)
'if rpm > 1500 then 1500
rpm = IIf(rpm > Mrevs, Mrevs, rpm)
'Time for 1 Rev
TimOneRev = 60 / rpm
'Total Revs Required
TotNumRevs = Lg / Feed
'Totalling Revs per pass
TotTime = TotNumRevs * TimOneRev
Tot = Tot + TotTime
Cells(Last, 3) = "Dia of Cut"
Cells(c + Last, 3) = CutDia
Cells(Last, 4) = "RPM"
Cells(c + Last, 4) = rpm
Cells(Last, 5) = "Time for 1 rev(Secs)"
Cells(c + Last, 5) = TimOneRev
Cells(Last, 6) = "Tot Turns/Cut"
Cells(c + Last, 6) = TotNumRevs
Cells(Last, 7) = "Tot Time/Cut"
Cells(c + Last, 7) = TotTime
Next Tsec
Range("H" & Last) = "Op Time (sec)"
Range("H" & Last + 1) = Tot
'Range("B8") = Tot
Range("I" & Last) = "Total Cuts"
Range("I" & Last + 1) = c
' Totals all the times
Set Rng = Range(Range("H1"), Range("H" & Rows.Count).End(xlUp))
For Each Dn In Rng
If IsNumeric(Dn) Then
oSum = oSum + Dn.Value
End If
Next Dn
Range("A10").Value = "Total M/C Time (min)"
Range("B10").Value = oSum / 60
Range("B8").Value = oSum
End Sub
Would like to take things a step further if its possible and you have more time
If i set up a columns with material groups
with surface speeds and feeds and depths of cut
an example as follows :-
Material Cs Dcut Feed
Carbon steel 250 2.5 .3
Stainless 175 2 .25
Aluminium 400 4 .35
Brass 350 3 .35
If we had another row called material("A9") and input a material into the "(B9") column could we pull the data across to our other "B" columns
What do you think
Once again thanks for all your help