You got me on the right track
Thanks
Sub Add_hours()
Application.ScreenUpdating = False
ActiveSheet.Unprotect Password:="driller"
Dim r As Range
Dim v As Range
Dim c As Range
Set v = Range("D4:D53")
Set r = Range("F4:F53")
Set c = ActiveCell
For Each c In v
If (c) 24 Then GoTo errorline Else: GoTo line1
line1:
Next c
r.FormulaR1C1 = "=RC[-2]+RC[-1]"
r.Copy
Range("E4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
r = ""
v.FormulaR1C1 = "0"
GoTo Lastline
errorline:
MsgBox ("Kun tall mellom 0 og 24")
Lastline:
ActiveSheet.Protect Password:="driller", DrawingObjects:=True,
Contents:=True, Scenarios:=True
End Sub
*** Sent via Developersdex
http://www.developersdex.com ***