Macro help

J

jschping

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!
 
M

Mike H

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
 
J

jschping

It worked! Thanks so much.

Mike H said:
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
 

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