Thread: On error
View Single Post
  #2  
Old April 19th, 2009, 02:17 PM posted to microsoft.public.excel.worksheet.functions
Jacob Skaria
external usenet poster
 
Posts: 5,952
Default On error

Try using the On Error statement.. Refer the below link

Sub ref()

On Error GoTo Handler

ActiveSheet.Unprotect Password:="abc"
ActiveWorkbook.UpdateLink Name:= _
"asdasd", Type:=xlExcelLinks
ActiveSheet.Protect Password:="abc"

Handler:
ActiveSheet.Protect Password:="abc"

End Sub


If this post helps click Yes
---------------
Jacob Skaria


"Kashyap" wrote:

Hi, I have code as below which will update links..

On error sheet will be unlocked.. how to lock the sheet again and exit sub?

Sub ref()

ActiveSheet.Unprotect Password:="abc"

ActiveWorkbook.UpdateLink Name:= _
"asdasd", _
Type:=xlExcelLinks

ActiveSheet.Protect Password:="abc"

End Sub