Macro Copy Paste from one to another based on cell value
Closed
DPD
-
26 May 2016 à 12:55
vcoolio Posts 1411 Registration date Thursday 24 July 2014 Status Contributor Last seen 6 September 2024 - 27 May 2016 à 00:26
vcoolio Posts 1411 Registration date Thursday 24 July 2014 Status Contributor Last seen 6 September 2024 - 27 May 2016 à 00:26
Related:
- Macro Copy Paste from one to another based on cell value
- Copy and paste macro - Excel Forum
- Excel conditional formatting based on another cell - Excel Forum
- How to change account based in instagram - Instagram Forum
- Automatically send emails from excel based on cell content - Excel Forum
- Pi copy paste - Guide
1 response
vcoolio
Posts
1411
Registration date
Thursday 24 July 2014
Status
Contributor
Last seen
6 September 2024
262
27 May 2016 à 00:26
27 May 2016 à 00:26
Hello DPD,
Your code appears to work just fine but if you are not happy with it, I've refined it a little for you as follows:-
I've altered line 11 a little just in case other users don't spell "YES" as you would like them to. So, "YES", "Yes" or "yes" should all work.
You can also change the sheet reference to Sheets("Phase II") if you prefer. I generally prefer to use the actual sheet code in a macro (I'm assuming that your sheet "Phase II" is Sheet2).
I hope that this helps.
Cheerio,
vcoolio.
Your code appears to work just fine but if you are not happy with it, I've refined it a little for you as follows:-
Sub Yes1()
Application.ScreenUpdating = False
Dim i As Integer
Dim LastRow As Long
LastRow = Cells(Rows.Count, "J").End(xlUp).Row
For i = 2 To LastRow
If UCase(Cells(i, 10).Value) = UCase("YES") Then
Range(Cells(i, 1), Cells(i, 6)).Copy Sheet2.Range("A" & Rows.Count).End(3)(2)
End If
Next
Application.CutCopyMode = False
Application.ScreenUpdating = True
Sheet2.Select
End Sub
I've altered line 11 a little just in case other users don't spell "YES" as you would like them to. So, "YES", "Yes" or "yes" should all work.
You can also change the sheet reference to Sheets("Phase II") if you prefer. I generally prefer to use the actual sheet code in a macro (I'm assuming that your sheet "Phase II" is Sheet2).
I hope that this helps.
Cheerio,
vcoolio.