F
FARAZ QURESHI
My code as below works great. The only problem is that the ErrorHandler
message shows up even if the complete task works perfect!
Is it only that I have placed the ErrorHandler somewhere incorrectly?
Sub FARAZCUT()
On Error GoTo ErrorHandler
Range("A4").End(xlDown).Select
ActiveCell.Offset(1, 0).Activate
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("H5:H3099").Select
Range("H3099").Activate
Selection.FormulaR1C1 = _
"=IF(ISNUMBER(RC[-1]),DATEDIF(RC[-1],NOW(),""Y""),"""")"
Range("AF5:AF3099").Select
Range("AF3099").Activate
Selection.FormulaR1C1 = _
"=+SUM(RC[-2],RC[-4],RC[-6],RC[-8],RC[-10],RC[-12],RC[-14])"
Range("AU5:AU3099").Select
Range("AU3099").Activate
Selection.FormulaR1C1 = _
"=+SUM(RC[-2],RC[-4],RC[-6],RC[-8],RC[-10],RC[-12],RC[-14])"
Range("BG5:BG3099").Select
Range("BG3099").Activate
Selection.FormulaR1C1 = "=+RC[-4]+RC[-3]-RC[-2]+RC[-1]"
Range("BL5:BL3099").Select
Range("BL3099").Activate
Selection.FormulaR1C1 = "=+RC[-4]+RC[-3]-RC[-2]+RC[-1]"
Range("BM5:BM3099").Select
Range("BM3099").Activate
Selection.FormulaR1C1 = "=+RC[-6]-RC[-1]"
Range("BW5:BW3099").Select
Range("BW3099").Activate
Selection.FormulaR1C1 = "=IF(AND(RC[-11]=0,RC[-16]=0),0,1)"
Range("BY5:BY3099").Select
Range("BY1722").Activate
Application.CutCopyMode = False
Selection.FormulaR1C1 = _
"=IF(AND(RC49=""ADJUSTED"",RC59=0,RC64=0),0,COUNTA(RC1:RC76)-7)"
Range("A4").End(xlDown).Select
ActiveCell.Offset(0, 77).Activate
Range(Selection, Selection.End(xlUp)).Select
ErrorHandler:
MsgBox "Copy Something First!"
End Sub
message shows up even if the complete task works perfect!
Is it only that I have placed the ErrorHandler somewhere incorrectly?
Sub FARAZCUT()
On Error GoTo ErrorHandler
Range("A4").End(xlDown).Select
ActiveCell.Offset(1, 0).Activate
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("H5:H3099").Select
Range("H3099").Activate
Selection.FormulaR1C1 = _
"=IF(ISNUMBER(RC[-1]),DATEDIF(RC[-1],NOW(),""Y""),"""")"
Range("AF5:AF3099").Select
Range("AF3099").Activate
Selection.FormulaR1C1 = _
"=+SUM(RC[-2],RC[-4],RC[-6],RC[-8],RC[-10],RC[-12],RC[-14])"
Range("AU5:AU3099").Select
Range("AU3099").Activate
Selection.FormulaR1C1 = _
"=+SUM(RC[-2],RC[-4],RC[-6],RC[-8],RC[-10],RC[-12],RC[-14])"
Range("BG5:BG3099").Select
Range("BG3099").Activate
Selection.FormulaR1C1 = "=+RC[-4]+RC[-3]-RC[-2]+RC[-1]"
Range("BL5:BL3099").Select
Range("BL3099").Activate
Selection.FormulaR1C1 = "=+RC[-4]+RC[-3]-RC[-2]+RC[-1]"
Range("BM5:BM3099").Select
Range("BM3099").Activate
Selection.FormulaR1C1 = "=+RC[-6]-RC[-1]"
Range("BW5:BW3099").Select
Range("BW3099").Activate
Selection.FormulaR1C1 = "=IF(AND(RC[-11]=0,RC[-16]=0),0,1)"
Range("BY5:BY3099").Select
Range("BY1722").Activate
Application.CutCopyMode = False
Selection.FormulaR1C1 = _
"=IF(AND(RC49=""ADJUSTED"",RC59=0,RC64=0),0,COUNTA(RC1:RC76)-7)"
Range("A4").End(xlDown).Select
ActiveCell.Offset(0, 77).Activate
Range(Selection, Selection.End(xlUp)).Select
ErrorHandler:
MsgBox "Copy Something First!"
End Sub