lastrow = Range("a1").End(xlDown).Row try this one as well
On Sat, Apr 18, 2009 at 10:37 PM, Tom Jeffries <tjeff...@gmail.com> wrote: > Try: > LastRow = ActiveSheet.Cells.Find(What:="*", SearchDirection:=xlPrevious, > SearchOrder:=xlByRows).Row > > On Fri, Apr 17, 2009 at 8:01 PM, boney <shwet...@gmail.com> wrote: > >> >> I have two sheets A and B . I need to copy the columns ( A through an >> unknown number of columns ) from sheet A into sheet B starting from >> Row 52 . Issue I have is >> >> --> Find the last row of the column (since its variable with each >> column ) >> --> A simpler way to do this . >> >> Here is what I have so far >> >> Dim temp As String >> temp = "Some file name of sheet A" >> temp 1 = "Some file name of sheet B" >> >> Workbooks.Open fileName:=temp >> >> ThisWorkbook.Activate >> >> i = 1 >> j = 1 >> >> `finding last cell to which I need to select in sheet A >> LRow = fileName.Cells(Rows.Count, j).End(xlUp).Row >> >> ' While loop to go thru each cell in colum 1 of sheet A and copy >> it to column of sheet B starting from cell (A,52) >> Do Until i < 6000 >> >> Worksheets("temp1's name").Cells(i + 51, j).Value = temp.Cells(i, >> j).Value >> >> i = i + 1 >> >> Loop >> >> >> > > > > -- Thanks & Regards, Harmeet Singh --~--~---------~--~----~------------~-------~--~----~ ------------------------------------------------------------------------------------- Some important links for excel users: 1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at http://www.excelitems.com 2. Excel tutorials at http://www.excel-macros.blogspot.com 3. Learn VBA Macros at http://www.vbamacros.blogspot.com 4. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com If you find any spam message in the group, please send an email to: Ayush Jain @ jainayus...@gmail.com or Ashish Jain @ 26may.1...@gmail.com ------------------------------------------------------------------------------------- -~----------~----~----~----~------~----~------~--~---