LongitudeValue:
'Longitude Value
C = C + 1
SrcWkb.Worksheets("sheet1").Range("N8:P8").Copy
DstWks1.Cells(R, C).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
FarEndSiteName:
'Farend SIte Name
C = C + 1
SrcWkb.Worksheets("Sheet1").Range("A").Copy
DstWks1.Cells(R, C).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
当LongitudeValue
代码块出现错误时,是否可以在两段代码之间跳转,以便代码从FarEndSiteName
恢复?
答案 0 :(得分:2)
使用On Error Goto <Label>
典型用途是
Sub MySub()
Dim ...
On Error Goto EH
' code...
CleanUp:
On Error Resume Next
' Tidy up code...
Exit Sub
EH:
If Err.Number = <some particular error> Then
' error handling code
Resume ' or Resume Next
End If
GoTo CleanUp
End Sub