Autofill Question
Since you're putting headers in row 1, can you use row 1 to determine the next
available column?
And can you pick out a column that can be used to determine the last used row.
I used row 1 and column A in the following:
dim LastRow as long
dim NextCol as long
dim wks as worksheet
set wks = worksheets("sheet999")
with wks
NextCol = .cells(1,.columns.count).end(xltoleft).column + 1
lastrow = .cells(.rows.count,"A").end(xlup).row
.range(.cells(2,nextcol),.cells(lastrow,nextcol)). formula _
= "=a2*c2"
end with
(untested, uncompiled. Watch for typos.)
Scott J wrote:
I would like to use the autofill function but am not sure the best way to
start. I have a spreadsheet that will vary on the number of columns of data
and rows. I want to find the first blank column, select the second row
(first row I will place a header) place a formula in the second row and
autofill to the last row of data.
Assume current sheet has columns A:E
Assume 100 rows of data
Assume formula to autofill in column is A2*C2
Hopefully this makes sense,
Thanks,
SJ
--
Dave Peterson
|