ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   AutoFill Macro Issue (https://www.excelbanter.com/excel-discussion-misc-queries/179897-autofill-macro-issue.html)

Jon

AutoFill Macro Issue
 
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

joel

AutoFill Macro Issue
 
Lets assume that you can use column B to determine the last row of data

Range("A1").FormulaR1C1 = "=IF(R[1]C[1]=R[2]C[1],1,0)"
LastRow = Range("B" & Rows.count).end(xlup).row
Range("A1").AutoFill Destination:=Range("A1:A" & Lastrow), Type:=xlFillDefault

"Jon" wrote:

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



All times are GMT +1. The time now is 01:36 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com