Selected Cell File Matching & Processing

binar

Board Regular
Joined
Aug 20, 2006
Messages
71
Fellow Forum Members,
Below is a link to an Excel 2007 sample layout I have uploaded to describe a task that requires a Macro to be capable of detecting what cell is currently selected. Is such a thing possible with a Macro? If the answer is yes, then please read on below where I describe the task I want to accomplish in more detail:

http://www.box.net/shared/9ikmx3j2b4


I would be very grateful if anyone out there could help me develop a macro that matches one of five templates to a list of names I have listed in “Column A”. The template are text files that reside in C:\Templates folder and are for simplicity sake are named:

•1one.txt
•2two.txt
•3three.txt
•4four.txt
•5five.txt

My names are listed in cells A1 through A26 and for simplicity sake the names are as follow:

•Cell A1 = Document1
•Cell A2 = Document2
•Cell A3 = Document3
•Etc….

My goal is to have an individual button coded to target each of the five template text files which I need to manually match to the correct Document name. The buttons I'm seeking to setup are named:

•1one
•2two
•3three
•4four
•5five

The macro can detect which cell in Column A is currently selected. So if I want to match template "1one.txt" to the name “Document3”, all I have to do is select Cell A3 ("Document3") and click the button that is assigned to template “1one.txt” which is button “1one”. Once I manually make this match and hit the "1one" button, the macro copies the file “1one.txt” (located in C:\Templates), and then renames the matched template file with the name “Document3.txt” and then it pastes the “Document3.txt” file in a folder located in C:\Output. Also, the macro also makes a list of the matched / processed files in "Column H"

Attached is an Excel file that shows a descriptive layout to provide further clarification. Essentially, I'm seeking to manually match custom names to specific external text files with the help of buttons.

I'm just seeking for the basic code for only one button. It is not necessary to code all five buttons. Any help will be greatly appreciated.
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result

Forum statistics

Threads
1,224,550
Messages
6,179,463
Members
452,915
Latest member
hannnahheileen

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top