PeterJohns27
New Member
- Joined
- Jun 17, 2014
- Messages
- 22
After earlier post this week, managed to correct a last row problem with a little help from Alex. This current macro works fine upto the last line, where despite a +1 , it continues to paste into the same row!! what silly mistake / error this time
Rich (BB code):
Sub Ekkie()
Dim WsI As Worksheet
Dim WsT As Worksheet
Dim WsR As Worksheet
Dim WsL As Worksheet
Dim I As Integer
Dim T As Integer
Dim lastRowWsT As Long
Dim lastRowWsL As Long
Dim lastRowWsR As Long
Set WsT = Worksheets("Template")
Set WsI = Worksheets("Interim")
Set WsR = Worksheets("Results")
Set WsL = Worksheets("Latest")
lastRowWsT = WsT.Cells(Rows.Count, "A").End(xlUp).Row
lastRowWsL = WsL.Cells(Rows.Count, "B").End(xlUp).Row
lastRowWsR = WsR.Cells(Rows.Count, "B").End(xlUp).Row
Application.ScreenUpdating = True
For T = 2 To lastRowWsT
'T = Range("A2:A")
With WsT
'Sheets("Template").Select
.Range("A" & T, "T" & T).Copy
End With
'Sheets("Interim").Select
With WsI
.Range("B3:U3").PasteSpecial xlPasteValues
.Range("B3:C3").Copy
.Range("B4:C4").PasteSpecial xlPasteValues
.Range("B4:U4").Copy
End With
With WsR
'Sheets("Results").Select
.Range("B" & lastRowWsR + 1).PasteSpecial Paste:=xlPasteAll
End With
Application.CutCopyMode = False
Next T
Application.ScreenUpdating = False
End Sub