View Single Post
  #8   Report Post  
Dave Peterson
 
Posts: n/a
Default

Try it with a workbook with two worksheets.

And make sure sheets(1) isn't the activesheet.

Those unqualified range objects usually refer to the activesheet. If the
activesheet is not the correct sheet, then you get an error.



Trevor Shuttleworth wrote:

Dave

I didn't notice that and you are right. However, in my testing it works
fine ... and I'm not sure why.

?rng.Address
$D$1:$D$17

Any thoughts ?

Regards

Trevor

"Dave Peterson" wrote in message
...
This link looks funny to me:

Set rng = .Range(.Cells(col), .Cells(Rows.Count, col).End(xlUp))

Did you mean:

Set rng = .Range(.Cells(rw, col), .Cells(Rows.Count, col).End(xlUp))

(added "rw" in the first .cells() portion.)

"Greg B..." wrote:

Thank you Trevor

Greg


--

Dave Peterson


--

Dave Peterson