• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Excel Macro for extract data from different worksheets

Sumesh

New Member
Dear Sirs,

Kindly help me with an excel macro for extracting specific data from different work sheets.

I am attaching the excel file for your reference. In that you can find a summary sheet, wherein the data from different work sheet is summarised.

Hope I will get a solution for this.

Regards,

Sumesh
 

Attachments

  • Leave SettlementReport.xlsx
    117 KB · Views: 11
Note that you have one duplicate entry for Employee code 21448. You will have to check such things.

Here's basic code which works with the posted data.
Code:
Public Sub MakeSummary()
Dim ws As Worksheet
Dim i As Long: i = 2
For Each ws In ActiveWorkbook.Sheets
  If ws.Name <> "Summary" Then
  With Sheets("Summary")
  .Cells(i, 1).Value = ws.Range("H2").Value
  .Cells(i, 2).Value = ws.Range("D2").Value
  .Cells(i, 3).Value = ws.Range("D3").Value
  .Cells(i, 4).Value = ws.Range("B21").Value
  .Cells(i, 5).Value = ws.Range("D21").Value
  .Cells(i, 6).Value = ws.Range("C22").Value
  i = i + 1
  End With
  End If
Next
End Sub
 
Dear Shri,

Thanks for your reply. There will be duplicate entries, since the leave settlements are being paid multiple times in an year. This should also be captured in the report.

Regards,

Sumesh
 
Back
Top