#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 38
Default VB Coding

I have a spread sheet with all cells locked except B1. Spreadsheet is
protected allowing access to unlocked cells.

I would like to be able to step through the spreadsheet by "unlocking" the
next cell when data is entered into B1 and for the cursor to move to that
next cell.

I would like this sequence to be repeated until all required cells have been
completed.

Try as I may I cannot get the program to even unlock the first cell in the
sequence so as to allow the cursor to be moved to that cell.
I am using a Change event that first unprotects the sheet, purports to
unlock the next cell (on the next row - 7 columns further along.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
Application.ScreenUpdating = False
Application.EnableEvents = False
ActiveSheet.Unprotect Password:="MyPass"
'If Target.Row = 1 Then
If Not Intersect(Target, Range("B:B")) Is Nothing Then GoTo last
Target.Offset(1, 7).Locked = False

GoTo last

last:
Application.EnableEvents = True
Application.ScreenUpdating = True
ActiveSheet.Protect Password:="MyPass"
End Sub

What am I doing wrong?

regards
John
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,203
Default VB Coding

I believe if you will change
If Not Intersect(Target, Range("B:B")) Is Nothing Then GoTo last
Target.Offset(1, 7).Locked = False

to
If Not Intersect(Target, Range("B:B")) Is Nothing Then
Target.Offset(1, 7).Locked = False
End If

plus then you can do away with the "GoTo last" statement right after that.


"johnsail" wrote:

I have a spread sheet with all cells locked except B1. Spreadsheet is
protected allowing access to unlocked cells.

I would like to be able to step through the spreadsheet by "unlocking" the
next cell when data is entered into B1 and for the cursor to move to that
next cell.

I would like this sequence to be repeated until all required cells have been
completed.

Try as I may I cannot get the program to even unlock the first cell in the
sequence so as to allow the cursor to be moved to that cell.
I am using a Change event that first unprotects the sheet, purports to
unlock the next cell (on the next row - 7 columns further along.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
Application.ScreenUpdating = False
Application.EnableEvents = False
ActiveSheet.Unprotect Password:="MyPass"
'If Target.Row = 1 Then
If Not Intersect(Target, Range("B:B")) Is Nothing Then GoTo last
Target.Offset(1, 7).Locked = False

GoTo last

last:
Application.EnableEvents = True
Application.ScreenUpdating = True
ActiveSheet.Protect Password:="MyPass"
End Sub

What am I doing wrong?

regards
John

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
sum by coding without 0 kaja New Users to Excel 1 March 2nd 08 09:09 PM
sum by coding [email protected] New Users to Excel 1 February 27th 08 01:12 PM
How to fix the coding? Eric Excel Worksheet Functions 4 June 20th 07 02:42 PM
coding maisy1 Excel Discussion (Misc queries) 1 August 6th 06 08:58 PM
Coding metaltecks Excel Discussion (Misc queries) 1 April 17th 06 10:12 PM


All times are GMT +1. The time now is 06:54 PM.

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

About Us

"It's about Microsoft Excel"