I have a excel file containing over 100 sheets and I want to merge whatever data these 100 worksheets have in column A on a new sheet named "Import"
How can I do this? Have uploaded an attachment
I have a excel file containing over 100 sheets and I want to merge whatever data these 100 worksheets have in column A on a new sheet named "Import"
How can I do this? Have uploaded an attachment
Last edited by Tomboy; 01-18-2011 at 06:34 PM.
see attachment, run macro "test"
its workin on the raw data that I supplied, thanx, but it not working on the actual data, getting the error message "Run time error 1004" No cells were found.
it looks for text and data in column 1 as in example. So the example do not correspond to the real data in terms of data type
I'd use
![]()
Sub snb() For Each sh In Sheets If sh.Name <> "Result" Then c01 = c01 & "|" & Join(Application.Transpose(sh.UsedRange.Columns(1)), "|") Next Sheets("Result").Cells(1).Resize(UBound(Split(c01, "|"))) = Application.Transpose(Split(Mid(c01, 2), "|")) End Sub
Hi, thanx mate, this is producing the desired result with the actual data.
Cheers, if u can explain the code, it wud be gr8 for me.
For Each sh In Sheets
--
Next
'Walk' through all sheets in the workbook
If sh.Name <> "Result" Then
If the name of the sheet isn't 'Result' then do:
sh.UsedRange.Columns(1)
determine the area that has been used (values, formulae, etc) in the sheet; take column 1 of that area.
Application.Transpose(..)
convert that first column into a 1-dimensional array
join(...,"|")
convert that 1-dimensional array to a textstring with a pipeline "|" as separator
c01 = c01 & "|" &
add this textstring to the variable c01 in which all previous textstrings have been stored.
Sheets("Result").Cells(1).Resize(UBound(Split(c01, "|")))
Select a range in sheet 'Result' that has the same size as the number of separate values in textstring c01
split(c01,"|")
Convert the textstring c01 into a 1-dimensional array
application.transpose(..)convert the 1-dimensional array to a vertical one.
And I prefer
If you can explain the code, it would be great for me
to
if u can explain the code, it wud be gr8 for me.
Last edited by snb; 01-19-2011 at 11:30 AM.
Hi,
Thanks for the detailed explanation. Noted, will avoid using slangs in conversation. Can you suggest what all changes I should make if the data that I'm tryin to grab/consolidate is on a seperate excel file "RawData.xls". This works well but it also fetches the data from the sheets in the workbook that are not part of this exercise.
Also, seen your message that you would like to review my curriculum. Can you messgae me your email address so that I can forward it.
Although you are 'hijacking', you'll find the answers on concatenating row, column and range here
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks