Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
SharonP.
 
Posts: n/a
Default VBA code to identify last row in a sheet

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!
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default VBA code to identify last row in a sheet

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

dim LastRow as Long
With worksheets("sheet1")
lastrow = .cells(.rows.count,"x").end(xlup).row
.range("a3:A" & lastrow).formular1c1 = .range("a2").formular1c1
end with

SharonP. wrote:

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!


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
SharonP.
 
Posts: n/a
Default VBA code to identify last row in a sheet

I'll give that a shot and let you know. Thanks!

"Dave Peterson" wrote:

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

dim LastRow as Long
With worksheets("sheet1")
lastrow = .cells(.rows.count,"x").end(xlup).row
.range("a3:A" & lastrow).formular1c1 = .range("a2").formular1c1
end with

SharonP. wrote:

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!


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips
 
Posts: n/a
Default VBA code to identify last row in a sheet


iLastRow = Cells(Rows.Count,"A").End(xlUp).Row
With Range("A2")
.Autofill .resize(iLastRow - 1)
End With

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)

"SharonP." wrote in message
...
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!



  #5   Report Post  
Posted to microsoft.public.excel.misc
SharonP.
 
Posts: n/a
Default VBA code to identify last row in a sheet

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.

"Bob Phillips" wrote:


iLastRow = Cells(Rows.Count,"A").End(xlUp).Row
With Range("A2")
.Autofill .resize(iLastRow - 1)
End With

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)

"SharonP." wrote in message
...
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!






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
AUTO FILTER NOT CHANGING RESULTS Dejan Excel Discussion (Misc queries) 25 October 6th 05 02:01 PM
Using other workbooks.. DavidMunday Excel Worksheet Functions 2 July 1st 05 07:35 AM
Copying multiple sheets from one book 2 another and undertake spec Pank Mehta Excel Discussion (Misc queries) 14 March 16th 05 04:41 PM
how do i create an access code sheet to number my office files an. dana New Users to Excel 1 February 12th 05 03:49 AM
how can i select all the cells with same color on a sheet if there are multipale colors by vba code uobt Charts and Charting in Excel 1 December 15th 04 05:27 PM


All times are GMT +1. The time now is 03:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"