View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Determine specific range

Set SrcRange = Mybook.Worksheets(ShtName(N)).Range(Range("A2"),
Range("A2").SpecialCells(xlLastCell))


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"sgl" wrote in message
...
Hi all,

I have the following code

Dim MyBook as Workbook
Dim SrcRange as Range
Dim ShtName as Variant
Dim N as Interger

... Code ...

set

SrcRange=Mybook.Workshhets(ShtName(N)).Range(Range ("A2"),Range("A2").Special
Cells(xlLastCell))

... morwe code

This gives me an Application or Object Defined Error. If I use the

following
it works well but I do not get the specific range I need.

set SrcRange=Mybook.Workshhets(ShtName(N)).UsedRange

Can someone pleasse help with this as it is driving me barmy

Thanx in Advance/sgl