ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   filling down to the end of a data set automatically (https://www.excelbanter.com/excel-discussion-misc-queries/228675-filling-down-end-data-set-automatically.html)

eklem

filling down to the end of a data set automatically
 
I am trying to move large quantities of information between two programs and
their only common format is Excel. However, the formatting of the cells is
different and I want to create a macro that fixes the formatting since this
will be done a lot. The problem is that I need to add a few columns. I am
currently dragging down to fill in the cells but the problem is that I don't
know the length of the file that the macro is working on. I need it to fill
down through the same row that the rest of the data ends at. The cells in
the columns being filled down each have the same word in them. Is there a
way that I can do this in the macro?

Gary''s Student

filling down to the end of a data set automatically
 
Here is a simple example. Say we have data in column A and a formula or
constant in B1 and we want to autofill column B down to match column A:

Sub AutoFilll()
n = Cells(Rows.Count, "A").End(xlUp).Row
Range("B1").AutoFill Destination:=Range("B1:B" & n)
End Sub
--
Gary''s Student - gsnu200848


"eklem" wrote:

I am trying to move large quantities of information between two programs and
their only common format is Excel. However, the formatting of the cells is
different and I want to create a macro that fixes the formatting since this
will be done a lot. The problem is that I need to add a few columns. I am
currently dragging down to fill in the cells but the problem is that I don't
know the length of the file that the macro is working on. I need it to fill
down through the same row that the rest of the data ends at. The cells in
the columns being filled down each have the same word in them. Is there a
way that I can do this in the macro?


eklem

filling down to the end of a data set automatically
 
Thank you. I have something working now.

"Gary''s Student" wrote:

Here is a simple example. Say we have data in column A and a formula or
constant in B1 and we want to autofill column B down to match column A:

Sub AutoFilll()
n = Cells(Rows.Count, "A").End(xlUp).Row
Range("B1").AutoFill Destination:=Range("B1:B" & n)
End Sub
--
Gary''s Student - gsnu200848





All times are GMT +1. The time now is 09:28 PM.

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