LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default 2003 & 2007 Differences in Locking Cells Syntax

The code below runs fine in Excel 2007, but 2003 does not like it.
I`m not sure why. It gives me a runtime error and says it is unable
to set the Locked property of the range class.

I tried commenting out the first line (WS.Cells.Locked = False) and
changing the second statement to"

WS.Range(Cells(row,col),Cells(row,col)).Locked = True

However, this did not help.

Does anyone see what I am doing wrong? Thanks, Alan

Sub DisableCellInput(WS As Worksheet, row As Long, col As Long)
'
' This subroutine locks and greys out the cell
'
WS.Cells.Locked = False
' Lock cell for input
WS.Cells(row, col).Locked = True
' Fill cell with light grey
WS.Cells(row, col).Interior.ColorIndex = 15
' Turn text into a slightly darker grey
WS.Cells(row, col).Font.ColorIndex = 48
' Protect the worksheet
WS.Protect UserInterfaceOnly:=True
End Sub
 
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
Application Name differences between Excel 2003 and 2007 SteveM Excel Programming 4 August 19th 09 12:55 PM
excel 2007 differences to 2003 questions George Applegate[_2_] Excel Discussion (Misc queries) 0 May 4th 09 08:41 PM
Differences in Excel macro recording from 2003 to 2007! Help! KjS Excel Programming 0 January 21st 09 08:02 PM
can you summarize differences between Excel 2000, 2003 & 2007? LSL Excel Discussion (Misc queries) 2 August 7th 08 03:39 PM
Excel Macros - Any Major Differences Between 2003 and 2007 bk Excel Worksheet Functions 1 November 20th 07 03:56 PM


All times are GMT +1. The time now is 08:50 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"