Dear all,
I have below code in a module to do some multiple checks..I want these checks to be done before any sheet gets de-activated in general (I am excluding 2 sheets as mentioned in code).
When i keyin this code under Sub Workbook_SheetDeactivate(ByVal Sh As Object), it throws up an ERROR message.
Could anyone please help whats the mistake i'm doing there? or any other best alternative to meet my requirement..?
PS: When keying-in this code under Sub Workbook_SheetDeactivate(ByVal Sh As Object), i wont declare "Dim Sh As Worksheet" as its not required.
Sub textforimage()
Dim Sh As Worksheet
Set Sh = ActiveSheet
If Sh.Name <> "Macro" And Sh.Name <> "Revision History" Then
If Sh.Pictures.Count = 0 Then
Exit Sub
Else
Sh.Pictures.Select
If Selection.Name = "New name" Then
Exit Sub
Else
Application.EnableEvents = False
Sh.Activate
Application.EnableEvents = True
MsgBox "This Sheet carries manually copied IMAGE file..So all check points will be RESET on: " & Sh.Name, vbExclamation, "Copied IMAGE found"
Sh.Pictures.Select
Selection.Name = "New name"
End If
End If
Else
End If
End Sub
Thanks for your help in advance.
Bookmarks