Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 90115

Copy one cell from multiple workbooks

$
0
0

I'm new to VBA. I have a series of workbooks from which I have to copy one cell and paste it to one final workbook. Is there a way to open a desired workbook (based on it's name in the table (final workbook) so that it opens a workbook that has the same name as is specified in first row of each column), copy value of desired cell and paste it to the same column where the file names are located and do this to the whole table as there is a lot of columns?

I have alredy managed to make a part of the code:

Dim i As Integer
For i = 1 To 2187
    Cells(i, 1).Select
    Selection.Copy
    ChDir "path"
    Workbooks.OpenText Filename:= _
        "Selection.Paste.Value" _

The problem is with last part where I paste value of the cell to search box. VBA types "Selection.Paste.Value" instead of what I copied and wanted to paste


Viewing all articles
Browse latest Browse all 90115

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>