Results 1 to 13 of 13

need help of vba code to pull data multiple times into master sheet

Threaded View

  1. #1
    Forum Contributor
    Join Date
    07-23-2013
    Location
    bangalore
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    143

    need help of vba code to pull data multiple times into master sheet

    Dear Excel & VBA Experts

    I need ur help on data extract from sheet to sheet through column header values, i have set of data on sheet1,2..loop end of sheet

    i want pull column data from multiple sheet column values into masterdata sheet depends upon column header values assigned in masterdata sheet.. my code works fine! but i want pull data if column header repeats more than one also

    SO_NBR this is one heading in multiple sheets i cant pull col values not more than once under if SO_NBR repeats more than once.


    
    sub pulldata()
    Dim rFind As Range, sFind As Range, sAddr As String, ws As Worksheet, rng As Range, LR&, ms As Worksheet
    Application.ScreenUpdating = 0
    Set ws = Sheets("MASTERDATA")
    ws.Range("A2:Fq" & Rows.Count).ClearContents
     NR = 2
     For Each ms In ActiveWorkbook.Sheets
     Set rng = ms.Range("A1:Fq1")
     LR = ms.Cells.Find("*", , , , xlByRows, xlPrevious).Row
           If ms.Name <> ws.Name Then
             For Each sFind In rng
                If Len(sFind) Then
                    With ws.Rows(1)
                        Set rFind = .Find(sFind, .Cells(.Cells.Count), xlValues, xlWhole)
                            If Not rFind Is Nothing Then
                                sAddr = rFind.Address
                                Do
                                sFind.Offset(1).Resize(LR - 1).Copy
                                ws.Cells(NR, rFind.Column).PasteSpecial xlValues
                                Loop While rFind.Address <> sAddr
                                sAddr = ""
                            End If
                    End With
                End If
             Next
           End If
           NR = ws.Cells.Find("*", , , , xlByRows, xlPrevious).Row + 1
     Next
      Application.CutCopyMode = 0
    Set ms = Nothing
    Set ws = Nothing
    Set rng = Nothing
    Set rFind = Nothing
    Application.ScreenUpdating = True
    End Sub
    find the attachment mentioned as expected result sheets is my requirement
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. pull data from two sheet and paste into master sheet with desired column's only
    By breadwinner in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-13-2014, 03:39 AM
  2. Filter data from a Master sheet based on multiple criteria by VBA code
    By judeprem in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-27-2013, 03:27 PM
  3. Pull data from specific cells on multiple worksheets onto one master sheet
    By WorkforceMedia in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-07-2013, 03:25 AM
  4. Replies: 3
    Last Post: 09-27-2012, 09:49 AM
  5. Pull a sequential pattern from another sheet multiple times
    By Affy in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 02-27-2012, 10:20 PM

Tags for this Thread

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