Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cells object question
I am using the Cells object to set the "locked" property of
my spreadsheet. The line looks like this: Cells.locked = True ' or can be False I feel real uncomfortable using that code by itself. Shouldn't I pre-qualify the Cells object with another object such as "ThisWorkbook" or something?? I just want to ensure that this code runs on the workbook it was intended for and not another active workbook. Thank you! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cells object question
Unless you know for certain that the sheet you are concerned with is the
activesheet then yes, you should always qualify the range object with the relevant sheet, eg ThisWorkbook.Worksheets("Sheet1").Cells.etc In passing, I can't imagine why one would ever do .Cells.locked = False Regards, Peter T "Robert Crandal" wrote in message ... I am using the Cells object to set the "locked" property of my spreadsheet. The line looks like this: Cells.locked = True ' or can be False I feel real uncomfortable using that code by itself. Shouldn't I pre-qualify the Cells object with another object such as "ThisWorkbook" or something?? I just want to ensure that this code runs on the workbook it was intended for and not another active workbook. Thank you! |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cells object question
I always try to qualify my ranges.
With activesheet .cells.locked = ... Actually, I'd use: Dim wks as worksheet set wks = activesheet with wks .cells.locked = ... By using that wks variable (declared as a worksheet), I'll get all the helpful intellisense from the VBE. I think it makes writing code much easier. Robert Crandal wrote: I am using the Cells object to set the "locked" property of my spreadsheet. The line looks like this: Cells.locked = True ' or can be False I feel real uncomfortable using that code by itself. Shouldn't I pre-qualify the Cells object with another object such as "ThisWorkbook" or something?? I just want to ensure that this code runs on the workbook it was intended for and not another active workbook. Thank you! -- Dave Peterson |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cells object question
Maybe because not all sheets need to have protection??? For example, nobody
uses my personal PC, and I don't care whether or not some of my sheets or protected or not.....therefore, all the cells may be unlocked with a call to ".Cells.locked = False"??? But ya, I understand that most people would rather have their spreadsheet entirely locked. "Peter T" <peter_t@discussions wrote in message ... In passing, I can't imagine why one would ever do .Cells.locked = False |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Activate Object question | Excel Worksheet Functions | |||
Activate Object question | Excel Worksheet Functions | |||
Range Object Question | Excel Programming | |||
Automation object question | Excel Programming | |||
Object Variable question | Excel Programming |