SimpleSusan
New Member
- Joined
- May 8, 2013
- Messages
- 7
Hi, as my name suggests, I'm not that cluey when it comes to writing VBA. I have read through a huge number of posts and still can't seem to get the code I need. My scenario is:
I have a workbook (AAA System File) that has worksheet (Master Summary) with data in it from B6 to AF6. The value in B6 is the unique ID for the file.
I have another workbook (AAB Incident Records) that contains a worksheet (Master Summary) with a list of IDs in column B.
What I want to do is code a command button in the AAA System File that when clicked:
1) copies the data from Worksheet "Master Summary" B6 to AF6
2) Opens workbook "AAB Incident Records"
3) Selects worksheet "Master Summary"
4) looks for the unique ID in column B that matches the copied cell B6 from the previous workbook
5) Once found, pastes the copied row of data in the correct row
6) Saves the file "AAB Incident Records"
7) Closes the file "AAB Incident Records"
Points 6 and 7 I can do easily. But no matter what I do, I can't seem to get the match then copy to work. I'd be happy to compromise have the entire row pasted rather than just the range B to AF.
I guess I'll need some sort of error handler also for the odd event where the copied ID does not appear in the AAB Incident Records "Master Summary" list
Can anyone help me please? Hopefully I've provided enough information.
Thanks, Susan
I have a workbook (AAA System File) that has worksheet (Master Summary) with data in it from B6 to AF6. The value in B6 is the unique ID for the file.
I have another workbook (AAB Incident Records) that contains a worksheet (Master Summary) with a list of IDs in column B.
What I want to do is code a command button in the AAA System File that when clicked:
1) copies the data from Worksheet "Master Summary" B6 to AF6
2) Opens workbook "AAB Incident Records"
3) Selects worksheet "Master Summary"
4) looks for the unique ID in column B that matches the copied cell B6 from the previous workbook
5) Once found, pastes the copied row of data in the correct row
6) Saves the file "AAB Incident Records"
7) Closes the file "AAB Incident Records"
Points 6 and 7 I can do easily. But no matter what I do, I can't seem to get the match then copy to work. I'd be happy to compromise have the entire row pasted rather than just the range B to AF.
I guess I'll need some sort of error handler also for the odd event where the copied ID does not appear in the AAB Incident Records "Master Summary" list
Can anyone help me please? Hopefully I've provided enough information.
Thanks, Susan