Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Jun 2006
    Posts
    88
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cell Not Selecting (2003 SP2)

    Below is the code I have in Worksheet 2. Once it runs I want it to select cell C31 on Worksheet 2. It does do this, but the black outline around the cell that would normally be there is not. If you just start typing, you are in the correct cell, but there is no visual indicator to let you know that it has selected cell C31. Any thoughts? Thanks!

    Private Sub Worksheet_Change(ByVal Target As Range)
    On Error Resume Next

    If Not Intersect(Target, Range("D25")) Is Nothing Then
    If Not Intersect(Target, Range("D25")) = "" Then
    Worksheets(1).Unprotect Password:="password"
    Worksheets(1).Range("D25") = Range("D25")
    Worksheets(1).Range("D25").Locked = True
    Worksheets(1).Range("D25").Interior.ColorIndex = x1ColorIndexNone
    Worksheets(1).Range("D25").Font.ColorIndex = 1
    Worksheets(1).Protect Password:="password"
    Worksheets(2).Range("C31").Select
    Else
    Worksheets(1).Unprotect Password:="password"
    Worksheets(1).Range("D25") = Range("D25")
    Worksheets(1).Range("D25").Locked = False
    Worksheets(1).Range("D25").Interior.ColorIndex = 6
    Worksheets(1).Range("D25").Font.ColorIndex = 5
    Worksheets(1).Protect Password:="password"
    Worksheets(2).Range("C31").Select
    End If
    End If
    End Sub

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Cell Not Selecting (2003 SP2)

    Try inserting

    Application.ScreenUpdating = False

    below the first If ... Then, and

    Application.ScreenUpdating = True

    below the first End If.

    Note: x1ColorIndexNone should be xlColorIndexNone (i.e. an L instead of the digit 1)

  3. #3
    Star Lounger
    Join Date
    Jun 2006
    Posts
    88
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Cell Not Selecting (2003 SP2)

    That took care of it! Thanks for the additional note about the 1 in my xlColorIndexNone. I didn't even notice that.

    Thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •