ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro help (https://www.excelbanter.com/excel-programming/435780-macro-help.html)

jschping

Macro help
 
Hi,

I created a macro for automating the input of a delimited text file. Once
all the stuff is imported, I want to reformat some of the data. I have the
formula ready, but have no clue how to make it apply to the whole column if I
don't know ahead of time how many rows the column will contain. I can
manually put it in the top cell and drag it down, but I want it to be part of
the macro. How do I do this?

Thanks!

Mike H

Macro help
 
Hi,

It would have helped to see the formula and where it is to go but this is
one way

lastrow = Sheets("Sheet1").Cells(Cells.Rows.Count, "A").End(xlUp).Row
Range("B1").Formula = "=A1"
Range("B1:B" & lastrow).FillDown

Mike

"jschping" wrote:

Hi,

I created a macro for automating the input of a delimited text file. Once
all the stuff is imported, I want to reformat some of the data. I have the
formula ready, but have no clue how to make it apply to the whole column if I
don't know ahead of time how many rows the column will contain. I can
manually put it in the top cell and drag it down, but I want it to be part of
the macro. How do I do this?

Thanks!


jschping

Macro help
 
It worked! Thanks so much.

"Mike H" wrote:

Hi,

It would have helped to see the formula and where it is to go but this is
one way

lastrow = Sheets("Sheet1").Cells(Cells.Rows.Count, "A").End(xlUp).Row
Range("B1").Formula = "=A1"
Range("B1:B" & lastrow).FillDown

Mike

"jschping" wrote:

Hi,

I created a macro for automating the input of a delimited text file. Once
all the stuff is imported, I want to reformat some of the data. I have the
formula ready, but have no clue how to make it apply to the whole column if I
don't know ahead of time how many rows the column will contain. I can
manually put it in the top cell and drag it down, but I want it to be part of
the macro. How do I do this?

Thanks!



All times are GMT +1. The time now is 03:44 AM.

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