View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default selecting a cell

Hi,

In the first snippet of code your trying to select a range on an inactive
worksheet and you can't do that or at least I don't know how.

On the second you make the sheet active so can select a range.

Mike

"MJKelly" wrote:


Hi,
using excel 2003.

Can you tell me why the following code is not working? Why do I have
to perform this action in two steps?

Not working:
ThisWorkbook.Sheets("Staff Monday").Range("B2").Select

Working:
ThisWorkbook.Sheets("Staff Monday").Select
Range("B2").Select

I have pasted values to a large range in "Staff Monday" and do not
want the range to remain selected once the code has run.

thanks,
Matt