Auto fill a column

D

dwake

I would like to create a macro that fills a column for me from the first
cell. My dilemma is that the amount of rows of data are ever changing, and I
would like the macro to fill until there is no more data. Any help would be
appreciated.
 
D

Dave Peterson

If I know my data, I can usually pick out a column that always has data in it if
that row is used.

If you can do the same, you could use code like:

Option Explicit
Sub testme()

Dim wks As Worksheet
Dim LastRow As Long

Set wks = Worksheets("Sheet1")

With wks
LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row
.Range("A1:A" & LastRow).Formula = "=c1&""- -""&d1"
End With
End Sub

I filled A1:A(lastrow in B) with a formula that concatenated the value in column
C with "- -" and then the value in column D.

If this doesn't help, you may want to give more info--where the top cell is
located, which column can be used to determine the lastrow (if any) and how that
range should be filled.
 

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