I want to,
Extract text from only second row of all excel files in folder along with file name and update in a new file, with the text and file name.
(PS: the row is merged column cells)
Appreciate any help. Thanks!
Printable View
I want to,
Extract text from only second row of all excel files in folder along with file name and update in a new file, with the text and file name.
(PS: the row is merged column cells)
Appreciate any help. Thanks!
Links to get you started:
https://www.thespreadsheetguru.com/t...a-given-folder
https://stackoverflow.com/questions/...lder-using-vba
one sheet or multiple sheets to each workbook?Quote:
the row is merged column cells)
here is an example for processing all the files in a folder, it only looks at the first worksheet, it also does not look at the merged cells, but that is not hard to add in
this was typed directly into the browser, so may contain typos or code errorsCode:set xl = createobject("excel.application")
pth = "C:\mypath\" ' change to suit
fname = dir(pth & "*.xls") ' find first xls file in folder
do while len(fname) > 0
set xl.wb = workbooks.open(pth & fname)
s = Join(WorksheetFunction.Transpose(WorksheetFunction.Transpose(Range("a2").Resize(, 5))), "\") ' change the resize and separator to suit
debug.print s
wb.close false ' do not save changes
fname = dir ' get next file
loop
xl.quit
set xl = nothing