See code below...
This code checks range c2 in worksheet Hours and based on the value it prints the text HOURS to the next available D cell in worksheet Work. It works but it's too long as it goes up to 14. I need decimals involved too so if it's for example 3.25 or 3.5 it rounds down and prints 3 HOURS if its 3.75 it round up and prints 4 HOURS. Please let me know if you know of a loop to check through .25 to 14 and print the appropriate amount of HOURS text...Thank you in advance!
This code checks range c2 in worksheet Hours and based on the value it prints the text HOURS to the next available D cell in worksheet Work. It works but it's too long as it goes up to 14. I need decimals involved too so if it's for example 3.25 or 3.5 it rounds down and prints 3 HOURS if its 3.75 it round up and prints 4 HOURS. Please let me know if you know of a loop to check through .25 to 14 and print the appropriate amount of HOURS text...Thank you in advance!
Code:
Set sh = wb.Sheets("Hours")
If sh.Range("c2") = "0.25" Then
Set sh = wb.Sheets("Work")
sh.Range("D" & Rows.Count).End(xlUp).Offset(1).Value = "HOURS"
End If
Set sh = wb.Sheets("Hours")
If sh.Range("c2") = "0.5" Then
Set sh = wb.Sheets("Work")
sh.Range("D" & Rows.Count).End(xlUp).Offset(1).Value = "HOURS"
End If
Set sh = wb.Sheets("Hours")
If sh.Range("c2") = "0.75" Then
Set sh = wb.Sheets("Work")
sh.Range("D" & Rows.Count).End(xlUp).Offset(1).Value = "HOURS"
End If
Set sh = wb.Sheets("Hours")
If sh.Range("c2") = "1" Then
Set sh = wb.Sheets("Work")
sh.Range("D" & Rows.Count).End(xlUp).Offset(1).Value = "HOURS"
End If
Set sh = wb.Sheets("Hours")
If sh.Range("c2") = "1.25" Then
Set sh = wb.Sheets("Work")
sh.Range("D" & Rows.Count).End(xlUp).Offset(1).Value = "HOURS"
End If
Set sh = wb.Sheets("Hours")
If sh.Range("c2") = "1.5" Then
Set sh = wb.Sheets("Work")
sh.Range("D" & Rows.Count).End(xlUp).Offset(1).Value = "HOURS"
End If
Set sh = wb.Sheets("Hours")
If sh.Range("c2") = "1.75" Then
Set sh = wb.Sheets("Work")
sh.Range("D" & Rows.Count).End(xlUp).Offset(1).Value = "HOURS"
sh.Range("D" & Rows.Count).End(xlUp).Offset(1).Value = "HOURS"
End If
Set sh = wb.Sheets("Hours")
If sh.Range("c2") = "2" Then
Set sh = wb.Sheets("Work")
sh.Range("D" & Rows.Count).End(xlUp).Offset(1).Value = "HOURS"
sh.Range("D" & Rows.Count).End(xlUp).Offset(1).Value = "HOURS"
End If
Set sh = wb.Sheets("Hours")