close

Can someone suggest simple (I'm a beginner) VBA code to identify the last
used row in a particular sheet? Then, once the last used row is identified,
use that variable to extend formulas on different sheets from row A2 to make
the used row number?

I'm working with a spreadsheet that is so large, I'm trying to fit the
needed rows with the input data which changes constantly.

Thanks!

I like to pick out a column that I know has data in it:

dim LastRow as Long
With worksheets(quot;sheet1quot;)
lastrow = .cells(.rows.count,quot;xquot;).end(xlup).row
.range(quot;a3:Aquot; amp; lastrow).formular1c1 = .range(quot;a2quot;).formular1c1
end with

SharonP. wrote:
gt;
gt; Can someone suggest simple (I'm a beginner) VBA code to identify the last
gt; used row in a particular sheet? Then, once the last used row is identified,
gt; use that variable to extend formulas on different sheets from row A2 to make
gt; the used row number?
gt;
gt; I'm working with a spreadsheet that is so large, I'm trying to fit the
gt; needed rows with the input data which changes constantly.
gt;
gt; Thanks!

--

Dave Peterson


iLastRow = Cells(Rows.Count,quot;Aquot;).End(xlUp).Row
With Range(quot;A2quot;)
.Autofill .resize(iLastRow - 1)
End With

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)

quot;SharonP.quot; gt; wrote in message
...
gt; Can someone suggest simple (I'm a beginner) VBA code to identify the last
gt; used row in a particular sheet? Then, once the last used row is
identified,
gt; use that variable to extend formulas on different sheets from row A2 to
make
gt; the used row number?
gt;
gt; I'm working with a spreadsheet that is so large, I'm trying to fit the
gt; needed rows with the input data which changes constantly.
gt;
gt; Thanks!
I'll give that a shot and let you know. Thanks!

quot;Dave Petersonquot; wrote:

gt; I like to pick out a column that I know has data in it:
gt;
gt; dim LastRow as Long
gt; With worksheets(quot;sheet1quot;)
gt; lastrow = .cells(.rows.count,quot;xquot;).end(xlup).row
gt; .range(quot;a3:Aquot; amp; lastrow).formular1c1 = .range(quot;a2quot;).formular1c1
gt; end with
gt;
gt; SharonP. wrote:
gt; gt;
gt; gt; Can someone suggest simple (I'm a beginner) VBA code to identify the last
gt; gt; used row in a particular sheet? Then, once the last used row is identified,
gt; gt; use that variable to extend formulas on different sheets from row A2 to make
gt; gt; the used row number?
gt; gt;
gt; gt; I'm working with a spreadsheet that is so large, I'm trying to fit the
gt; gt; needed rows with the input data which changes constantly.
gt; gt;
gt; gt; Thanks!
gt;
gt; --
gt;
gt; Dave Peterson
gt;

I'm very new at VBA and am unable to get this right. I've duplicated
the code and can run it but the result isn't expected. My sample
has two sheets - sheet1 and sheet2. I want to identify the last populated
row of data on sheet1. Then, I want to extend the formulas from sheet2 -
A1, B1, C1, D1 to the appropriate number of rows identified from sheet1.

What happens now with the sample code is the the autofill fills in the cell
contents on sheet1 A1 to the bottom of Sheet1 column A.

quot;Bob Phillipsquot; wrote:

gt;
gt; iLastRow = Cells(Rows.Count,quot;Aquot;).End(xlUp).Row
gt; With Range(quot;A2quot;)
gt; .Autofill .resize(iLastRow - 1)
gt; End With
gt;
gt; --
gt;
gt; HTH
gt;
gt; Bob Phillips
gt;
gt; (remove nothere from the email address if mailing direct)
gt;
gt; quot;SharonP.quot; gt; wrote in message
gt; ...
gt; gt; Can someone suggest simple (I'm a beginner) VBA code to identify the last
gt; gt; used row in a particular sheet? Then, once the last used row is
gt; identified,
gt; gt; use that variable to extend formulas on different sheets from row A2 to
gt; make
gt; gt; the used row number?
gt; gt;
gt; gt; I'm working with a spreadsheet that is so large, I'm trying to fit the
gt; gt; needed rows with the input data which changes constantly.
gt; gt;
gt; gt; Thanks!
gt;
gt;
gt;

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()