Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
runtime 1004 error
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)) |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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)) |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
runtime 1004 error
What does your with clause look like. Both of these statements are meant to
be within the bounds of a with statement. ..Cells or .Range must have a sheet specified from a with statement. If you do not have that with statement then this would bomb... -- HTH... Jim Thomlinson "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)) |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
runtime 1004 error
Sorry... My Bad 9since I gave you that code in the first place... Try this
Set rng = _ ..Range(.Cells(2, 1), .Cells(Rows.Count, .Cells(1, Columns.Count).End(xlToLeft).Column).End(xlUp)) Note the .Column -- HTH... Jim Thomlinson "Jim Thomlinson" wrote: What does your with clause look like. Both of these statements are meant to be within the bounds of a with statement. .Cells or .Range must have a sheet specified from a with statement. If you do not have that with statement then this would bomb... -- HTH... Jim Thomlinson "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)) |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Runtime Error 1004 | Excel Discussion (Misc queries) | |||
Runtime error 1004 | Excel Programming | |||
Runtime error 1004 | Excel Programming | |||
Excel 2003 Macro Error - Runtime error 1004 | Excel Discussion (Misc queries) | |||
Runtime error 1004 | Excel Programming |