Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 270
Default Cell Movement - Not Working Correctly

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!!!!
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 270
Default Cell Movement - Not Working Correctly

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.

"Don Guillett" wrote:

I tried your code, without protection, and it worked as desired.

--
Don Guillett
SalesAid Software

"Paige" wrote in message
...
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!!!!




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro not working correctly Andy_N1708 via OfficeKB.com Excel Discussion (Misc queries) 3 May 27th 10 03:35 AM
Filters not working correctly EZ Setting up and Configuration of Excel 1 September 1st 08 05:15 PM
Formulas not working correctly Curt D. Excel Worksheet Functions 6 November 1st 07 08:48 PM
This is not working because I didn't write it correctly L.White Excel Programming 14 November 24th 05 10:17 AM
Sum function not working correctly in Excel (Skips Cell) Tony Excel Worksheet Functions 5 November 29th 04 11:52 PM


All times are GMT +1. The time now is 10:30 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"