anglais428
Well-known Member
- Joined
- Nov 23, 2009
- Messages
- 634
- Office Version
- 2016
- Platform
- Windows
Hi,
I have the current VBA code below which I would like to turn into a loop:
Any advise?
I have the current VBA code below which I would like to turn into a loop:
Code:
Dim NoYrs As Long 'number of years
Dim LRbf As Long 'last row
NoYrs = Sheets("Lists").Range("E655536").End(xlUp).Row - 1
LRbf = Sheets("BF").Range("A655536").End(xlUp).Row
' Get First batch
Sheets("BF").Select
Range(Cells(3, 4), Cells(LRbf, (NoYrs + 3))).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("Upload sheet").Select
Range("J2").Select
ActiveSheet.Paste
Application.CutCopyMode = False
'Get second batch
Sheets("BF").Select
Range(Cells(3, (NoYrs+3+1)), Cells(LRbf, (NoYrs * 2 + 3))).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("Upload sheet").Select
Range("J" & LRbf).Select
ActiveSheet.Paste
Application.CutCopyMode = False
Any advise?