Copy Paste in loop in loop
Closed
manojsaxena
Posts
3
Registration date
Sunday March 11, 2018
Status
Member
Last seen
March 13, 2018
-
Mar 12, 2018 at 01:15 AM
Blocked Profile - Mar 14, 2018 at 03:35 PM
Blocked Profile - Mar 14, 2018 at 03:35 PM
Related:
- Copy Paste in loop in loop
- Game loop - Download - Android emulators
- Fruity loop download - Download - Musical production
- Microsoft loop - Download - Organisation and teamwork
- Discord update failed loop - Guide
- Gateway laptop stuck in boot loop ✓ - Laptop Forum
Mar 13, 2018 at 12:58 AM
'
' CopyPaste Macro to copy first field from Sheet 1 into Sheet 2 selected cells and then copy all the selected cells in Sheet 2 base don filter to Sheet 3 at blank rows starting from selected column. Loop this till all values of Sheet 1 is exhusted.
'
'
' Loop to start
'Action 1-
Sheets("Sheet1").Select
Range("A2").Select
Application.CutCopyMode = False
Selection.Copy
' Action 2
Sheets("Sheet2").Select
Range("D3:D8").Select ' Select all filled in rows in column D
ActiveSheet.Paste
ActiveSheet.Range("$A$2:$D$8").AutoFilter Field:=1, Criteria1:="yes"
Range("B3:D8").Select ' I want this to be dynamic instead of fixed and shoudl select all whereever filter criteria is Yes
Application.CutCopyMode = False
Selection.Copy
' Action 3
Sheets("Sheet3").Select
Range("D3").Select
ActiveSheet.Paste
'Second iteration
'Action 1-
Sheets("Sheet1").Select
Range("A3").Select
Application.CutCopyMode = False
Selection.Copy
' Action 2
Sheets("Sheet2").Select
Sheets("Sheet2").Select
Range("D3:D8").Select ' Select all filled in rows in column D
ActiveSheet.Paste
ActiveSheet.Range("$A$2:$D$8").AutoFilter Field:=1, Criteria1:="yes"
Range("B3:D8").Select
Application.CutCopyMode = False
Selection.Copy
' Action 3
Sheets("Sheet3").Select
Range("D7").Select ' new blank line in sheet 3
ActiveSheet.Paste
'Third iteration
'Action 1-
Sheets("Sheet1").Select
Range("A4").Select
Application.CutCopyMode = False
Selection.Copy
'Action 2-
Sheets("Sheet2").Select
'ActiveSheet.Range("$A$2:$D$8").AutoFilter Field:=1
Range("D3:D8").Select ' Select all filled in rows in column D
ActiveSheet.Paste
ActiveSheet.Range("$A$2:$D$8").AutoFilter Field:=1, Criteria1:="yes"
Range("B3:D8").Select
Application.CutCopyMode = False
Selection.Copy
'Action 3-
Sheets("Sheet3").Select
Range("D11").Select
ActiveSheet.Paste
' And so on till all data of column A 2..of action 1 is exhusted ....
''Loop to start
End Sub
Mar 13, 2018 at 04:38 PM
Its structure is as follows:
or, if we wanted to skip numbers, we could do:
or, we can count down from a number. As in:
or, counting down by a number, as in:
I hope this helps. Try some of these. Let us know if you get stuck on YOUR code!
Mar 13, 2018 at 09:52 PM
Mar 14, 2018 at 03:35 PM
Had you of applied the loop, we could have went to the next issue of looking for the CRITERIA text entry of "YES". But, since you cannto even grasp the loop, it will be hard to explain how to inspect a cell for QUALIFIED entries!
Keep coming back, as there are others that will write you code, and maybe they can pick it from here, as I will not spend time writing code, to have the SCOPE of work change when it does't do exactly what you want, and you have no knowledge for yourself on how to arrange it so it does fit your model.
I hope you understand.