View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Meltad Meltad is offline
external usenet poster
 
Posts: 98
Default Copy latest date from one workbook to another

Hi,
I'm trying to copy rows from one workbook to another - all those rows which
have the most recent date (date in column c).
Tom Ogilvy supplied this code for me but it just copies one row not all
instances of that date, any ideas???


"Tom Ogilvy" wrote:

Sub LFmacro()

Dim nRows As Long
Dim i as Long
Dim Source as Range

ChDir "G:\Lou French macro"
Workbooks.Open Filename:="G:\Lou French macro\podnondel.CSV"

'copy latest date from podnondel workbook
'colour rows red

nrows = Application.CountA(Columns(3))
i = 1
Do While Cells(nrows, 3).Offset(-i, 0).Value = Cells(nrows, 3).Value
i = i + 1
Loop
Set Source = Cells(nrows, 3).Offset(-1 * (i - 1), 0).Resize(i).EntireRow
Source.Copy
Windows("LFmacro.XLS").Activate
cells(rows.count,3).End(xlup).offset(1,-2).Select
ActiveSheet.Paste

End Sub