Hi Everyone,
I would like to autofill or copy this formula
(this is the formula when it is in cell E2) to all columns that have text in Row 1 beginning with column E. It should autofill down to the last row that is not blank in column A.
I think this code sort of does the job but the autofill doesn't automatically figure out how many columns and rows to copy the formula to:
Thanks so much for any help you can offer!
P.S. If you could offer any advice on how to remove all the selecting when I record a macro that would be great also!
I would like to autofill or copy this formula
Excel Formula:
=IF($C2=E$1,$D2,"")
I think this code sort of does the job but the autofill doesn't automatically figure out how many columns and rows to copy the formula to:
VBA Code:
Range("E2").Value = "=IF(RC3=R1C,RC4,"""")"
Range("E2").Select
Selection.AutoFill Destination:=Range("E2:E35912")
Range("E2").Select
Selection.AutoFill Destination:=Range("E2:O2"), Type:=xlFillDefault
Range("F2").Select
Selection.AutoFill Destination:=Range("F2:F35912")
Range("G2").Select
Selection.AutoFill Destination:=Range("G2:G35912")
Range("H2").Select
Selection.AutoFill Destination:=Range("H2:H35912")
Range("I2").Select
Selection.AutoFill Destination:=Range("I2:I35912")
Range("J2").Select
Selection.AutoFill Destination:=Range("J2:J35912")
Range("K2").Select
Selection.AutoFill Destination:=Range("K2:K35912")
Range("L2").Select
Selection.AutoFill Destination:=Range("L2:L35912")
Range("M2").Select
Selection.AutoFill Destination:=Range("M2:M35912")
Range("N2").Select
Selection.AutoFill Destination:=Range("N2:N35912")
Range("O2").Select
Selection.AutoFill Destination:=Range("O2:O35912")
Thanks so much for any help you can offer!
P.S. If you could offer any advice on how to remove all the selecting when I record a macro that would be great also!