View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Clearing data from a so called protected sheet???

Assume you code is in a sheet name LCIS

You can use Sheets("1").Select and that sheet will be selected, but if you
next do

Range("A1").Select

then you will get an error because it will try to select

Worksheets("LCIS").Range("A1")
which is not on the active sheet.

Likewise
Worksheets("1").Select
Range("A1").Value = 3

would be the equivalent of
Worksheets("1").Select
Worksheets("LCIS").Range("A1").Value = 3

to actually assign the value to A1 of "1", you would need
Worksheets("1").Select
Worksheets("1").Range("A1").Value = 3

where Worksheets("1").Select would be optional and only for visible feedback
to the user.

If you don't need to select a sheet, it is always better to work with it
through references since this is usually much faster. Note that an
overwhelming majority of actions can be accomplished without selecting, but
sometimes it can not be avoided.

--
Regards,
Tom Ogilvy



"funkymonkUK" wrote:


sorry tom was surpose to be sheet("3") not lcis. Anyway it works a
treat. so in that case if I am coding on the Sheet then I must not use
terms such as sheets("1").select or . activate?


--
funkymonkUK
------------------------------------------------------------------------
funkymonkUK's Profile: http://www.excelforum.com/member.php...o&userid=18135
View this thread: http://www.excelforum.com/showthread...hreadid=542818