View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ouka[_6_] Ouka[_6_] is offline
external usenet poster
 
Posts: 1
Default Worksheet().Range(Cell(), Cell()) syntax?


Probably another newb question from me, but:

What is the proper syntax to use the Range(Cell(), Cell()) selection
when accessing a different worksheet?

example

On sheet1 I have the code:

Range(Cells(1, "A"), Cells(30, "A").select

This will of course select the range of cells A1:A30 on sheet1

It also works fine if I use

Worksheets("Sheet1").Range(Cells(1, "A"), Cells(30, "A")).select





However, if I use the code to try to select a different sheet, ala:

Worksheets("Sheet2").Range(Cells(1, "A"), Cells(30, "A")).select

I get an error back: "Run-time error '1004': Application-defined or
object-defined error"



Even if I make sheet2 the activesheet the code still returns the same
error.


--
Ouka
------------------------------------------------------------------------
Ouka's Profile: http://www.excelforum.com/member.php...o&userid=23988
View this thread: http://www.excelforum.com/showthread...hreadid=388946