AutoFill Macro Issue

J

Jon

Below I have copied the macro I'm trying to build. Basically I'm having an
issue with the AutoFill area. On the original macro I had it autofill to cell
A24. That is where my data ended. The problem is that I have a different
amount of data every day. It could be A24 one day the A145 the next...etc.
How can I get this macro to autofill down to where the data stops? It will
always be in column A and the data is in column B.
Thanks, here is the macro VBS:

ActiveCell.FormulaR1C1 = "=IF(R[1]C[1]=R[2]C[1],1,0)"
Range("A1").Select
Selection.AutoFill Destination:=Range("A1:A24"), Type:=xlFillDefault
Range("A1:A24").Select
End Sub
 
D

Dave Peterson

Dim LastRow as long
with activesheet
lastrow = .cells(.rows.count,"B").end(xlup).row
.range("a1:a" & lastrow).formular1c1 _
= "=IF(R[1]C[1]=R[2]C[1],1,0)"
end with

It fills the entire range with the formula instead of using filldown or
autofill.
Below I have copied the macro I'm trying to build. Basically I'm having an
issue with the AutoFill area. On the original macro I had it autofill to cell
A24. That is where my data ended. The problem is that I have a different
amount of data every day. It could be A24 one day the A145 the next...etc.
How can I get this macro to autofill down to where the data stops? It will
always be in column A and the data is in column B.
Thanks, here is the macro VBS:

ActiveCell.FormulaR1C1 = "=IF(R[1]C[1]=R[2]C[1],1,0)"
Range("A1").Select
Selection.AutoFill Destination:=Range("A1:A24"), Type:=xlFillDefault
Range("A1:A24").Select
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top