View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
isabelle isabelle is offline
external usenet poster
 
Posts: 587
Default Duplicate last row and other progressive numbers

hi John,

Public Sub Tester2()
Dim WB As Workbook
Dim SH As Worksheet
Dim LastRow As Long

Set WB = ActiveWorkbook
Set SH = WB.Sheets("UK")

With SH
LastRow = .Cells(.Rows.Count, 1).End(xlUp).Row
..Range(.Cells(LastRow, 1), .Cells(LastRow, 6)).AutoFill
Destination:=.Range(.Cells(LastRow, 1), .Cells(LastRow + 1, 6)),
Type:=xlFillDefault
..Range(.Cells(LastRow, 8), .Cells(LastRow, 10)).AutoFill
Destination:=.Range(.Cells(LastRow, 8), .Cells(LastRow + 1, 10)),
Type:=xlFillDefault
..Range(.Cells(LastRow, 7), .Cells(LastRow, 7)).Copy
..Range(.Cells(LastRow, 1), .Cells(LastRow + 1, 7))

End With
End Sub

isabelle


Le 2013-01-12 14:39, John a écrit :

Hallo,
the vba code is Ok; however, If I have a number on column G, ie 79560,
after the execution of the code I have 79561, 79562 and so on. It should
be always the same 79560.
I try to change Type:xlFillDefaul to Type:xlFillCopy but the progressive
number in column D is not anymore update and remain exactly as the
previous row.
Any suggestion is much appreciate.
Thanks and Regards
John