![]() |
Copy cells from one file into another
Hello,
what would be the easiest way to go through the a column in one file and find all the times that exceed 15 minutes, pull up the cells within that row with names and record these cells into another file after the last filled row.... Here's a part of the code I am trying to write.... it only records the cells of the latest time it finds into the row 251, not the first available one :( Dim aPath, aRange, aSheet As String Dim R, i, j As Integer aPath = "\\servername\" aFile = "FileName.xls" aSheet = "SheetName" Dim mybook As Workbook, xlsheet As Worksheet Set mybook = Workbooks.Open(aPath & aFile) For i = 3 To 250 respTime = mybook.Worksheets(hdSheet).Range("H" & i).Value If (respTime < "") Then respMins = Hour(respTime) * 60 + Minute(respTime) If (respMins 15) Then ' doesn't work as I want it R = Range("A65536").End(xlUp).Offset(1, 0).Row Worksheets("Weekly").Cells(R, 1) = mybook.Worksheets(hdSheet).Range("E" & i).Value Worksheets("Weekly").Cells(R, 2) = mybook.Worksheets(hdSheet).Range("H" & i).Value Worksheets("Weekly").Cells(R, 3) = mybook.Worksheets(hdSheet).Range("B" & i).Value End If End If Next i mybook.Close savechanges:=False |
All times are GMT +1. The time now is 08:33 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com