Copy Potential data from one sheet to another if condition met
Closed
Kyle
-
Sep 8, 2016 at 10:25 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Sep 15, 2016 at 11:35 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Sep 15, 2016 at 11:35 AM
Related:
- Excel copy data from one sheet to another if a condition is met
- Transfer data from one excel worksheet to another automatically - Guide
- Mark sheet in excel - Guide
- How to open excel sheet in notepad++ - Guide
- How to screenshot excel sheet - Guide
- Google sheet right to left - Guide
2 responses
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
555
Sep 8, 2016 at 11:30 AM
Sep 8, 2016 at 11:30 AM
Hi Kyle,
Try the following code:
How to implement and run a code:
- From Excel hit Alt + F11 to open the “Microsoft Visual Basic” window.
- Go to the top menu in the newly opened window > Insert > Module.
- Paste the code in the big white field.
- You can now close this window.
- Back at Excel, hit Alt + F8 to display the available macro’s.
- Double-click the macro you wish to run.
NOTE: macro’s cannot be reversed using the blue arrows. Always make sure you save your file (or create a back up to be entirely sure) before running a code, so you can re-open your file if something unforeseen happens or you want to go back to the situation before the code was run.
And below is a link where you can find the workbook similating your scenario.
Group letters D and F are found on sheet2 but only group letter D has a matching description, thus the value 333 will be copied over to sheet1.
Here is the link:
http://ge.tt/2CFqOBe2
Best regards,
Trowa
Try the following code:
Sub RunMe() Dim fRange As Range Sheets("Sheet1").Select For Each cell In Range("A2:A" & Range("A" & Rows.Count).End(xlUp).Row) Set fRange = Sheets("Sheet2").Columns("N:N").Find(cell.Value) If Not fRange Is Nothing Then If cell.Offset(0, 10).Value = fRange.Offset(0, -2).Value Then cell.Offset(0, 8).Value = fRange.Offset(0, -4).Value End If End If Next cell End Sub
How to implement and run a code:
- From Excel hit Alt + F11 to open the “Microsoft Visual Basic” window.
- Go to the top menu in the newly opened window > Insert > Module.
- Paste the code in the big white field.
- You can now close this window.
- Back at Excel, hit Alt + F8 to display the available macro’s.
- Double-click the macro you wish to run.
NOTE: macro’s cannot be reversed using the blue arrows. Always make sure you save your file (or create a back up to be entirely sure) before running a code, so you can re-open your file if something unforeseen happens or you want to go back to the situation before the code was run.
And below is a link where you can find the workbook similating your scenario.
Group letters D and F are found on sheet2 but only group letter D has a matching description, thus the value 333 will be copied over to sheet1.
Here is the link:
http://ge.tt/2CFqOBe2
Best regards,
Trowa
Sep 8, 2016 at 01:49 PM
I did those steps you listed above and I was given an error that says "subscript out of range". Would you mind running through and giving a quick explanation of each line of code for? I don't quite under stand the purpose of each command, and I think If I did I could alter it myself to make sure the range is acceptable and then add other commands I need as well.
again thanks for the reply!
Kyle