Macro Copy Paste from one to another based on cell value
Closed
DPD
-
May 26, 2016 at 12:55 PM
vcoolio Posts 1411 Registration date Thursday July 24, 2014 Status Moderator Last seen September 6, 2024 - May 27, 2016 at 12:26 AM
vcoolio Posts 1411 Registration date Thursday July 24, 2014 Status Moderator Last seen September 6, 2024 - May 27, 2016 at 12:26 AM
Related:
- Macro Copy Paste from one to another based on cell value
- Excel macro to create new sheet based on value in cells - Guide
- Discord invisible name copy and paste ✓ - Internet & Social Networks Forum
- If a cell has text then return value ✓ - Excel Forum
- If cell contains date then return value ✓ - Office Software Forum
- Excel send value to another cell - Guide
1 response
vcoolio
Posts
1411
Registration date
Thursday July 24, 2014
Status
Moderator
Last seen
September 6, 2024
262
May 27, 2016 at 12:26 AM
May 27, 2016 at 12:26 AM
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.