Since it's Valentine's week, I'll use an example that might better explain my need:
The Financial Analyst manages several Gift Shop Client files.
This analyst has a file already open called: "ABC GIFT SHOP INVENTORY"
He needs to extract a single sheet from a closed file that is stored on his Desktop on a regular basis that holds ever-changing pricing.
The analyst will push an icon on his toolbar that will run code that will:
1. Navigate to the user's Desktop
2. Locate a file on the Desktop that will always be called: "MARKET_PRICING.xlsx"
3. Open that Desktop file
4. Copy a sheet from that Desktop file called: "Fresh-Cut-Flowers"
5. Into the already open file called "ABC GIFT SHOP INVENTORY"
6. Close the file that was opened from the Desktop.
The obstacle is... NORMALLY, in the code you would define your SOURCE file ("MARKET_PRICING.xlsx") (closed sitting on Desktop)
and define your SOURCE sheet ("Fresh-Cut-Flowers)
and you'd define your DESTINATION file ("ABC GIFT SHOP INVENTORY") -- this is the one that's already open
The problem is, that the code needs to be generic enough to NOT DEFINE a specific DESTINATION file name (the one that's already open in the very beginning) because it will always be different as he works with different clients with different file names.
Examples of Various Client File/Destination File Names that Will Vary:
"ABC GIFT SHOP INVENTORY"
"XYZ I-FILE"
"123 GIFT AND CANDY SHOP INV"
The "known" that will always be the same is --- that all DESTINATION files will already have a file sitting it in called "Repair Data"
So, when the code needs to know where to paste the copied sheet, it can do the following:
The analyst will push an icon on his toolbar that will run code that will:
1.Verify that a file is already open that holds a sheet called: "REPAIR DATA"
...IF NO, produce message "DESTINATION" file is not open (and stop the code).
...If YES, proceed to Navigate to the user's Desktop
2. Locate a closed Desktop file that will always be called: MARKET_PRICING.xlsx
3. Open that file
4. Copy a sheet from that file called: "Fresh-Cut-Flowers"
5. Into the already open DESTINATION file called "ABC GIFT SHOP INVENTORY"
6. Close the file that opened from the Desktop.
Hope that helps!
Thanks so much for helping figure this out!
Bookmarks