Hi,
Oops , mike has your solution before i could give it to you, Anyways this is my code.
Private Sub print_roll_utilization()
'code by xlbiznes - Feb 24 2013
Dim counter As Integer
Dim main_loop As Boolean
Dim roll_len As Double
Dim rolls As Integer
'assuming that your data by default will start from row 3
counter = 3
main_loop = True
rolls = 0
If Me.Cells(counter, 1) = "" Then
MsgBox "No Data Found In Row 3 ", vbInformation, "Xlbiznes"
Exit Sub
End If
Do While main_loop = True
If Me.Cells(counter, 5) <> "" Then
roll_len = roll_len + Me.Cells(2, 5)
Else
If Me.Cells(counter, 6) <> "" Then
roll_len = roll_len + Me.Cells(2, 6)
Else
If Me.Cells(counter, 7) <> "" Then
roll_len = roll_len + Me.Cells(2, 7)
Else
If Me.Cells(counter, 8) <> "" Then
roll_len = roll_len + Me.Cells(2, 8)
End If
End If
End If
End If
If roll_len > 17.3 Then
Me.Cells(counter - 1, 1).Interior.Color = vbRed
Me.Cells(counter - 1, 1).Font.Color = vbWhite
Me.Cells(counter - 1, 1).Font.Underline = True
rolls = rolls + 1
roll_len = 0
Else
counter = counter + 1
End If
If Me.Cells(counter, 1) = "" Then
main_loop = False
MsgBox "Process Completed - You Would Require " & rolls & " Rolls To Print These Images ", vbInformation, "Xlbiznes"
Exit Sub
End If
Loop
End Sub
Bookmarks