Benjamin Verdelin
New Member
- Joined
- Aug 19, 2022
- Messages
- 4
- Office Version
- 365
- Platform
- Windows
Hi all
I am completely new to this community and somewhat new to VBA.
It was not possible for me to find a solution to this so I now reach out to you.
As the title says I am looking for a way to:
1. Copy data from Ark1 A3:DD3 in workbook "Lotseddel"
2. Open workbook "Masterfile" (where all data from previous lotseddel are stored)
3. Look at column A and see if the input in cell B3 from woorkbook Lotseddel is present (8 digit lot code)
4. Select the row for which the input in B3 is found
5. Replace data in that row with what was copied (it might be that data was previously copied for this 8 digit lot code so I would like to replace it, but NOT delete data for all the other lot codes)
6. If not found I want to select last row in the workbook Masterfile and simply insert the copied data
7. Close workbook Masterfile and leave Lotseddel open
I currently have a macro (button to click) for copying data from Lotseddel and inserting the data to the last row in workbook Masterfile.
However this means that I will get multiple entries of the same lot code as the macro is sometimes run 3-4 times.
Attached are two pictures:
1; List of lot codes where some appear two times (data was exported two times maybe by different people working on the same Lotseddel)
2; Current macro to copy data and insert to last row in Masterfile
Hope you will take the time to help.
Thx
I am completely new to this community and somewhat new to VBA.
It was not possible for me to find a solution to this so I now reach out to you.
As the title says I am looking for a way to:
1. Copy data from Ark1 A3:DD3 in workbook "Lotseddel"
2. Open workbook "Masterfile" (where all data from previous lotseddel are stored)
3. Look at column A and see if the input in cell B3 from woorkbook Lotseddel is present (8 digit lot code)
4. Select the row for which the input in B3 is found
5. Replace data in that row with what was copied (it might be that data was previously copied for this 8 digit lot code so I would like to replace it, but NOT delete data for all the other lot codes)
6. If not found I want to select last row in the workbook Masterfile and simply insert the copied data
7. Close workbook Masterfile and leave Lotseddel open
I currently have a macro (button to click) for copying data from Lotseddel and inserting the data to the last row in workbook Masterfile.
However this means that I will get multiple entries of the same lot code as the macro is sometimes run 3-4 times.
Attached are two pictures:
1; List of lot codes where some appear two times (data was exported two times maybe by different people working on the same Lotseddel)
2; Current macro to copy data and insert to last row in Masterfile
Hope you will take the time to help.
Thx