Extracting data from current workbook to another workbook using file path that is in a cell

drop05

Active Member
Joined
Mar 23, 2021
Messages
285
Office Version
  1. 365
Platform
  1. Windows
Hello,
1. using VBA, i am trying to think of a way to copy values from a whole column in workbook1 worksheet "sheet2", starting from column F on sheet2 and X number of columns to the right and paste the values into another workbook, lets call it workbook2, and the worksheet the values will paste into is called "Data" and have those copied values from the column starting from F onward just like how it is copied

I have code that has a user enter a number and the input is pasted into cell C10 on "sheet1" so that will be the X value. So if X is 3 i would like to copy columns F, G, H from sheet2 of this workbook.
I also have code that allows the user to select workbooks and the name/file path name is pasted into cell D7 of sheet1, same workbook and sheets as where the X value number is.

2. is there a way to use that value of D7 which has the text of the file path that i would like to paste these values copied from "sheet2" rather than have the user select it again using code like fileopen and closing the file. The reason why the file path text is there is because i have another module that runs code that copies an initialized template in a sheet from that file and have it output the file path that the user selects when selecting the file to copy the template from.

3. And if that is possible to implement it into the code below, this is code that runs other subs inside different modules that run code that copies that template from the selected file as mentioned and transfer data into that template that is in sheet2. That data is also the data i would like copied as explained up above. This is a final step i am stuck on with this code in the workbook.

Sub RunAll

Name1()
Name2()
Test1()
Test2()
Test3()
Last1()

End Sub


Any help would be appreciated, thank you in advance!
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

Forum statistics

Threads
1,214,834
Messages
6,121,877
Members
449,056
Latest member
ruhulaminappu

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