Hi! I have the following line of code that keeps giving me a "Run-time error '1004': Application-defined or object-defined error," and I can't seem to figure out why:
.Range(.Cells(7, 1), .Cells(x, lastcol)).Sort Key:=Columns(mycol), Order:=xlAscending, Header:=xlYes
My table extends from cell A7 to row x, column "lastcol," both of which are being found correctly (I checked). The line is preceded by a With statement selecting the worksheet I want to use. The column I'd like to sort by is
"mycol," another integer being found correctly. I've never embedded a .Cells statement in a Range statement before, but I read online that it should work, sooo....what the heck am I doing wrong?
Thank you!!
.Range(.Cells(7, 1), .Cells(x, lastcol)).Sort Key:=Columns(mycol), Order:=xlAscending, Header:=xlYes
My table extends from cell A7 to row x, column "lastcol," both of which are being found correctly (I checked). The line is preceded by a With statement selecting the worksheet I want to use. The column I'd like to sort by is
"mycol," another integer being found correctly. I've never embedded a .Cells statement in a Range statement before, but I read online that it should work, sooo....what the heck am I doing wrong?
Thank you!!