I made a few assumptions.
Like:  What to do if there is a "Code" in one of the sheets that is NOT 
represented in the Required Data sheet.
Or:  if not ALL codes in the Required Data sheet are repredented in each of the 
other sheets.

With this macro, if there are new codes in one of the detail sheets, it will be 
added to the Data sheet...

Paste this code in a VBA module:
(watch for line wraps that the email has added!)
================================================================
Option Explicit
Public Dict_Code
Sub CombineSheets()
    Dim CodeNo, R, LastRow, nRows
    Dim dSheet, sht, msg, HdrRow
    Set Dict_Code = CreateObject("Scripting.Dictionary")
        Dict_Code.RemoveAll
    dSheet = "Required data"
    HdrRow = 3
    Sheets(dSheet).Select
    nRows = ActiveCell.SpecialCells(xlLastCell).Row
    'Load Required Data into Dictionary Object
    For R = HdrRow To nRows
        If (Sheets(dSheet).Cells(R, "A").Value & "X" = "X") Then
            nRows = R - 1
            Exit For
        Else
            If (Not Dict_Code.exists(Sheets(dSheet).Cells(R, "A").Value)) Then
                    Dict_Code.Add Sheets(dSheet).Cells(R, "A").Value, R
            Else
                msg = "Duplicate Record:"
                msg = msg & Chr(13) & Sheets(dSheet).Cells(R, "A").Value & " 
Row: " _
                          & Dict_Code.Item(Sheets(dSheet).Cells(R, "A").Value)
                msg = msg & Chr(13) & Sheets(dSheet).Cells(R, "A").Value & " 
Row: " & R
                MsgBox msg
            End If
        End If
    Next R
    '---------------------------------------------------------------
    Sheets(dSheet).Range("B" & HdrRow & ":GZ65000").ClearContents
    '---------------------------------------------------------------
    For sht = 1 To Sheets.Count
        If (Sheets(sht).Name <> dSheet) Then
            Sheets(sht).Select
            Sheets(dSheet).Cells(HdrRow, sht + 1).Value = Sheets(sht).Name
            LastRow = ActiveCell.SpecialCells(xlLastCell).Row
            For R = 1 To LastRow
                If (Sheets(sht).Cells(R, "A").Value & "X" <> "X") Then
                    If (Not Dict_Code.exists(Sheets(sht).Cells(R, "A").Value)) 
Then
                    
'---------------------------------------------------------------
                            nRows = nRows + 1
                            Sheets(dSheet).Cells(nRows, "A").Value = 
Sheets(sht).Cells(R, "A").Value
                            Dict_Code.Add Sheets(sht).Cells(R, "A").Value, nRows
                    
'---------------------------------------------------------------
                    Else
                    
'---------------------------------------------------------------
                        
Sheets(dSheet).Cells(Dict_Code.Item(Sheets(sht).Cells(R, 
"A").Value), sht + 1).Value = _
                         Sheets(sht).Cells(R, "B").Value
                    
'---------------------------------------------------------------
                    End If
                End If
            Next R
        End If
    Next sht
    MsgBox "Finished"
End Sub
 
Paul
-----------------------------------------
“Do all the good you can,
By all the means you can,
In all the ways you can,
In all the places you can,
At all the times you can,
To all the people you can,
As long as ever you can.” - John Wesley
-----------------------------------------




________________________________
From: SAGAR KASANGOTTUWAR <sagarkasangottu...@gmail.com>
To: excel-macros@googlegroups.com
Sent: Fri, August 17, 2012 10:11:33 AM
Subject: $$Excel-Macros$$ combining data in one worksheet from other worksheets

Dear Friends, 

I want combine the data from other worksheets to one specific worksheet so 
kindly give me the fastest way to do same task.

Note. I HAVE NEAR ABOUT 200 worksheets which I WANT to combine.


THANKS IN ADVANCE,

Regards,

CA KSAGAR-- 
Join official facebook page of this forum @ 
https://www.facebook.com/discussexcel
 
FORUM RULES (1120+ members already BANNED for violation)
 
1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
 
2) Don't post a question in the thread of another member.
 
3) Don't post questions regarding breaking or bypassing any security measure.
 
4) Acknowledge the responses you receive, good or bad.
 
5) Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 

 
6) Jobs posting is not allowed.
 
7) Sharing copyrighted ebooks/pirated ebooks/their links is not allowed.
 
NOTE : Don't ever post personal or confidential data in a workbook. Forum 
owners 
and members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To post to this group, send email to excel-macros@googlegroups.com.
To unsubscribe from this group, send email to 
excel-macros+unsubscr...@googlegroups.com.

-- 
Join official facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES (1120+ members already BANNED for violation)

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.

2) Don't post a question in the thread of another member.

3) Don't post questions regarding breaking or bypassing any security measure.

4) Acknowledge the responses you receive, good or bad.

5)  Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 

6) Jobs posting is not allowed.

7) Sharing copyrighted ebooks/pirated ebooks/their links is not allowed.

NOTE  : Don't ever post personal or confidential data in a workbook. Forum 
owners and members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To post to this group, send email to excel-macros@googlegroups.com.
To unsubscribe from this group, send email to 
excel-macros+unsubscr...@googlegroups.com.


Reply via email to