Quote Originally Posted by Greg M View Post
Hi there,

Your code will operate on Table1 of whichever worksheet happens to be active when the code is executed - is this what you want? If not, you should use a fully qualified reference i.e.:


    Sheets("Appropriate Sheet name").Range("Table1[[#ALL],[Column1]:[Column4]]").Cells.Locked = True
I think you're right, but not the way you think!

What I say is "Table1" in my example has a different name on each sheet, so I was accessing the wrong table.

Now this seems to work:

     Range(ActiveSheet.ListObjects(1).name & "[[#ALL],[Column1]:[Column4]]").Cells.Locked = True
Thanks!