Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A little help grabbing the last cells

Status
Not open for further replies.

jackosieves

Petroleum
Feb 5, 2010
24
0
0
US
Hi guys. I am not the best at writing code. I typically just record simple macros. However, I have a sheet that gets updated daily and I want to be able to take the last 7 rows (a weeks worth) of data and export into a separate table on another sheet. Any help would be greatly appreciated. Thanks.
 
Replies continue below

Recommended for you

That's kind of essentially what I'm trying to do. The thing that is making it tough is the fact that the raw data is getting updated every day and I'm just trying to get it to where it only pulls the last 7 days at any given time. Something like, "Range("A65536").End(xlup).Select". Can I do .End(xlup)-1, -2, -3 etc?

 
Alright, I think I'm getting close here. I can't get my offset squared away. I actually want to take the last 8 rows, with data, in the spreadsheet. The dates go on for years.


Selection.End(xlDown).Select
ActiveCell.Offset(0, 1).Range("A1").Select
Selection.End(xlUp).Select
-->ActiveCell.Offset(-8, 0).Range("A1:L9").Select
ActiveCell.Activate
Selection.Copy
Sheets("All").Select
ActiveCell.Offset(0, 1).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
 
Oh, if you look again at the file I posted, notice on the summary tab that the dates automatically update. The dates use the " =TODAY() " function so the summary sheet always lists the last 7 days.

-- MechEng2005
 
Thanks for all of the help. I ended up getting it to do what I wanted by using the sumif() function. I set it up to where the data automatically gets pulled depending on what the date is. I'll continue to tweak it though and may try to incorporate what guys suggested in this sheet or others that I build.
 
Status
Not open for further replies.
Back
Top