Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-15-2013, 10:12 AM
tadleymansions tadleymansions is offline Unlocking cells with VB code in excel 2003 Windows XP Unlocking cells with VB code in excel 2003 Office 2003
Novice
Unlocking cells with VB code in excel 2003
 
Join Date: Aug 2012
Posts: 3
tadleymansions is on a distinguished road
Unhappy Unlocking cells with VB code in excel 2003

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
Reply With Quote
  #2  
Old 01-18-2013, 06:55 AM
OTPM OTPM is offline Unlocking cells with VB code in excel 2003 Windows 7 32bit Unlocking cells with VB code in excel 2003 Office 2010 32bit
Expert
 
Join Date: Apr 2011
Location: West Midlands
Posts: 981
OTPM is on a distinguished road
Default

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
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
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

Other Forums: Access Forums

All times are GMT -7. The time now is 10:38 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft