+ Reply to Thread
Results 1 to 4 of 4

Extracting data from different worksheets in desired format

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    03-11-2011
    Location
    Nepal
    MS-Off Ver
    MS Excel 2024
    Posts
    1,384

    Extracting data from different worksheets in desired format

    Hi,

    I have momentarily 3 worksheet at the moment and will goes increasing datewise.Hence I want to extract those data which I have shown as sample in 3rd worksheet "Expected Result" format which I want.

    Pls find enclosed in attachment.

    Thanx in advance.
    Attached Files Attached Files

  2. #2
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Extracting data from different worksheets in desired format

    Maybe :

    Sub Test()
      Dim wsTarget As Worksheet, wsTemp As Worksheet, rng As Range
    
      Application.ScreenUpdating = False
      Set wsTarget = Sheets("Expected Result")
      wsTarget.Rows("3:" & Application.Max(wsTarget.Cells.SpecialCells(xlCellTypeLastCell).Row, 3)).Clear
    
      For Each wsTemp In Worksheets
          With wsTemp
            If .Name <> wsTarget.Name Then
               .AutoFilterMode = False
               Set rng = .Range("A3:R" & .Cells(.Rows.Count, "A").End(xlUp).Row)
               rng.Columns("P").FormulaR1C1 = "=IF(R[-2]C1=""Type"",1,IF(OR(R[-2]C1=""Breakdown Details"",RC1=""""),"""",R[-1]C))"
               rng.Columns("Q").Value = .Name
               rng.Columns("R").FormulaR1C1 = "=IF(RC16=1,IF(R[-2]C1=""Type"",R[-2]C3,R[-1]C),"""")"
               rng.AutoFilter field:=16, Criteria1:=1
    
               Intersect(rng.SpecialCells(xlCellTypeVisible), .Columns("A:O")).Copy wsTarget.Cells(wsTarget.Rows.Count, "C").End(xlUp).Offset(1)
               Intersect(rng.SpecialCells(xlCellTypeVisible), .Columns("Q:R")).Copy wsTarget.Cells(wsTarget.Rows.Count, "A").End(xlUp).Offset(1)
    
               .AutoFilterMode = False
               .Columns("P:S").Clear
            End If
          End With
      Next wsTemp
    
      wsTarget.Range("A2").CurrentRegion.Borders.Weight = xlThin
      Application.ScreenUpdating = True
    End Sub

  3. #3
    Forum Contributor
    Join Date
    03-11-2011
    Location
    Nepal
    MS-Off Ver
    MS Excel 2024
    Posts
    1,384

    Re: Extracting data from different worksheets in desired format

    Thanx a lot to u and it did work.Its really awesome.
    Last edited by paradise2sr; 04-07-2016 at 10:27 PM.

  4. #4
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Extracting data from different worksheets in desired format

    You are welcome, glad to help.


    Regards

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 3
    Last Post: 09-15-2015, 06:07 AM
  2. Best Way to Transform Data into Desired Format
    By AntiPivotTable in forum Excel General
    Replies: 3
    Last Post: 01-07-2015, 05:43 PM
  3. [SOLVED] Macro to format raw data in to desired formatted data file.
    By bmbalamurali in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 03-21-2014, 01:49 PM
  4. [SOLVED] Extracting data from one table format and putting into a different viewing format
    By BeachRock in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-19-2014, 05:55 PM
  5. Extracting text into desired format in Excel
    By mpendle in forum Excel General
    Replies: 6
    Last Post: 10-10-2009, 02:06 PM
  6. [SOLVED] Extracting desired data from a list when the Unwanted list is provided
    By all4excel in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 05-11-2008, 10:33 AM
  7. extracting data from other worksheets
    By peiwen in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-03-2006, 05:50 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1