View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim May Jim May is offline
external usenet poster
 
Posts: 477
Default runtime 1004 error

I don't recall seeing (IN YOUR 2nd LINE) ... both (xlToLeft)).End(xlUp))
Maybe Excel is getting confused...
FWIW...
Jim

"Janis" wrote:

It is an application or object defined error. The first line works but the
second one gives the error in my sort macro. I'm trying to use the count to
left for the columns because the users keep adding columns. Do I have a
missing parenthesis? It seems like both lines are the same.
Thanks,
Set Rng = .Range(.Cells(2, 1), _
.Cells(Rows.Count, .Cells(1, Columns.Count).End(xlToLeft)).End(xlUp))
'Set Rng = .Range(.Cells(2, 1), .Cells(Rows.Count, 26).End(xlUp))