compiler error:expected end sub

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ANIL KUMAR N
    New Member
    • Oct 2014
    • 2

    compiler error:expected end sub

    Code:
    Sub LOCKED()
    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim Rng As Range
    Set Rng = Range("$a$1:$b$1")
    If Not Application.Intersect(Target, Rng) Is Nothing Then
        Sheets("Sheet 1").Unprotect
        If IsEmpty(Target) Then
            Target.LOCKED = False
        Else
            Target.LOCKED = True
        End If
        Sheets("Sheet 1").Protect
    End If
    End Sub
    pls fix this problem
    any suggetion will be appreciated
    Last edited by Rabbit; Oct 1 '14, 03:49 PM. Reason: Please use [code] and [/code] tags when posting code or formatted data.
  • ANIL KUMAR N
    New Member
    • Oct 2014
    • 2

    #2
    pl's any body can help me it is very needed to me

    Comment

    • twinnyfo
      Recognized Expert Moderator Specialist
      • Nov 2011
      • 3664

      #3
      Sub LOCKED() does not have an "End Sub" statement.

      It looks like you are showing two subs, when there should only be one.

      Comment

      Working...