Results 1 to 8 of 8

Copy Data from multiple sheets to Main datasheet

Threaded View

  1. #8
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Copy Data from multiple sheets to Main datasheet

    Hi Bogleda,

    This should get your CF:

    Sub Bogleda2(): Dim wt As Worksheet, ws As Worksheet, t As Long, r As Long, i As Long, D As Range
    Application.EnableEvents = False: t = 3: Set wt = Sheets("Table of Context"): wt.Activate
    wt.Range(Cells(t, 1), wt.Cells(Rows.Count - t, 1)).EntireRow.Clear
    For Each ws In Worksheets
    If ws.Name = wt.Name Or ws.Name = "CONVERSIONS" Or ws.Name = "DropDown Menus" Then GoTo GetNext
    r = 4: Do Until ws.Range("A" & r) = "": r = r + 1: Loop: r = r - 1
    For i = 4 To r: ws.Cells(r, 6) = ws.Name: Next i
    Set D = ws.Range(ws.Cells(4, 1), ws.Cells(r, 6)): r = r - 3
    D.Copy wt.Range("A" & t)
    t = t + r: wt.Columns.AutoFit: wt.Rows.AutoFit
    GetNext: Next: Application.EnableEvents = True: End Sub
    And - when you're building the full book, you could just Change the name of the event code in the ThisWorkbook module:

    Private Sub XWorkbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
                    Set Sh = ActiveSheet
    If Sh.Name = "Table of Context" Or Sh.Name = "CONVERSIONS" Or _
    Sh.Name = "DropDown Menus" Then Exit Sub
    If Target <> "" And Target.Column < 6 Then
    Dim wt As Worksheet, X As String, FN As String, F As Range, D, r As Long
    Set wt = Sheets("Table of Context"):  r = Target.Row: X = Cells(r, 1)
    If Target.Column = 1 Then X = Cells(r, 2)
    D = Range(Cells(r, 1), Cells(r, 6)): D(1, 6) = Sh.Name
    Set F = wt.Range("A:B").Find(X)
    If Not F Is Nothing Then
    Application.EnableEvents = False
    wt.Range(wt.Cells(F.Row, 1), wt.Cells(F.Row, 6)) = D
    Application.EnableEvents = True
    End If: End If: End Sub
    Last edited by xladept; 05-09-2014 at 02:43 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Copy data from multiple sheets to one main based on cell value
    By jdjenterprises in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-28-2013, 10:13 PM
  2. Replies: 2
    Last Post: 02-06-2013, 11:25 AM
  3. [SOLVED] Macro to get/copy data from multiple secondary sheets to main sheet
    By CaatalyyN616 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-29-2012, 04:22 AM
  4. copy data from main sheet to respective sub sheets
    By sshanku1985 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 03-14-2011, 12:26 PM
  5. Copy Varying Range Sizes from Multiple Sheets to Main Sheet
    By Wester in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-30-2010, 03:12 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