Cell Movement - Not Working Correctly

G

Guest

I have the following code:

Private Sub Worksheet_Change(ByVal Target As Range)
ActiveSheet.Unprotect Password:="test"
If Target.Address = "$C$65" Then
If Target.Value > 0 Then
Rows("66:77").Hidden = False
Range("$C$72").Select
Else
Rows("66:77").Hidden = True
Range("C72:H76").ClearContents
Range("C79").Select
End If
End If
ActiveSheet.Protect Password:="test"

When I enter a value of 1 or more in C65, it follows the code and unhides
rows 66:77 and takes me to C72, which it should. But then when I enter a
numeric value in C72 and hit enter, my cursor goes to C81, which is no where
in the above code or anywhere else in the rest of my code. After going to
C81, I can move the cursor back to C72, enter a numeric value again and hit
enter, and it reacts correctly by taking me to D72 (versus C81).

I've checked all my other code and there is nothing that references any of
these cells/rows other than the above. None of the cells are locked either.
Can someone advise what I'm doing wrong here; this is driving me CRAZY!!!!
 
G

Guest

Thanks, Don. It does work right without protection, but why would it not
work correctly with protection? That is what is bugging me; I thought I had
locked some cells, but that wasn't the case. I need the worksheet to be
protected, so this is why it's a problem.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top