![]() |
|
#1
|
|||
|
|||
![]()
Hi
Using excel 2003 I am unable to get cells unlocked using VB. I have been going round and round for weeks with this problem and am now ready for the "funny farm"! I know that I have had this working on previous occasions but now seem unable to get the simplest of code to work. For Example:- A single worksheet with all cells defined as general and all locked EXCEPT D1. The simple code:- Private Sub Worksheet_Change(ByVal Target As Range) If Not Intersect(Target, Range("D:D")) Is Nothing Then Target.Offset(3, -3).Locked = False Target.Offset(3, -3).Select End If End Sub Gives "Run time error 1004" Unable to set the Locked property of the Range class. Before my brain turns to total mush can someone please, please point out where I am going wrong. Last edited by tadleymansions; 01-16-2013 at 02:47 AM. Reason: smiley caused typo |
#2
|
|||
|
|||
![]()
Hi
I am not a VBA expert but your issue may be because you cannot unlock a cell before you unlock the Worksheet. You need to include code in your VBA to unlock the worksheet first before you unlock the cell. Then lock the worksheet again if you need to. Hope this helps. Good luck. Tony |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
In Excel 2007-After Selecting Visibe Cells-How do I "Copy to Visible cells" Only | mag | Excel | 0 | 10-28-2012 08:04 PM |
VBA Code to auto resize cells when text entered | OTPM | Excel Programming | 0 | 09-18-2011 04:21 AM |
VBA code to update record in Access 2003 using Userform in Excel | primmer3001 | Excel Programming | 0 | 08-29-2011 04:25 PM |
Unlocking documents | deekins | Word | 2 | 05-20-2009 12:07 PM |
Automatically entering/fill data in cells in Excel 2003 | dipdog | Excel | 0 | 08-17-2006 08:37 AM |