Hi,
I feel pretty silly for not being about to figure this one out. I'm literally just trying to do an hlookup in A1 and drag the formula all the way to the right. I'm getting an error on the last part of this code, no matter what i try.
What I've been trying to accomplish is entering the formula in A1, copying that, then offsetting that selection down a row and all the way to the right. After that, I'd go up one cell, select all the way to the left and paste the formula. That sounds super complicated now that I've typed it out but it should be pretty easy. No matter what I try, the bottom line errors with:
"Run-time error 1004: Select method of Range class failed.
Help appreciated!!
I feel pretty silly for not being about to figure this one out. I'm literally just trying to do an hlookup in A1 and drag the formula all the way to the right. I'm getting an error on the last part of this code, no matter what i try.
What I've been trying to accomplish is entering the formula in A1, copying that, then offsetting that selection down a row and all the way to the right. After that, I'd go up one cell, select all the way to the left and paste the formula. That sounds super complicated now that I've typed it out but it should be pretty easy. No matter what I try, the bottom line errors with:
"Run-time error 1004: Select method of Range class failed.
Help appreciated!!
Code:
Sheets("1537").Rows("1:1").Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Sheets("1537").Rows("1:1").NumberFormat = "General"
Sheets("1537").Range("A1").FormulaR1C1 = "=HLOOKUP(R[1]C,Headers!R,1,0)"
Sheets("1537").Range("A1").Copy
Sheets("1537").Range("B2").Select