+ Reply to Thread
Results 1 to 2 of 2

Macro to combine specific sheets only.

  1. #1
    Registered User
    Join Date
    06-18-2013
    Location
    india
    MS-Off Ver
    Excel 2010
    Posts
    16

    Macro to combine specific sheets only.

    Hi Team,

    Can we modify this macro which I get using this forum to combine specific data sheets only other than all data sheet in worksheet


    Sub integratie_Oeldere()

    Dim wsTest As Worksheet

    'check if sheet "ouput" already exist

    Const strSheetName As String = "Consolidated"

    Set wsTest = Nothing
    On Error Resume Next
    Set wsTest = ActiveWorkbook.Worksheets(strSheetName)
    On Error GoTo 0

    If wsTest Is Nothing Then
    Worksheets.Add.Name = strSheetName
    End If

    With Sheets("Consolidated")
    .UsedRange.ClearContents
    .Range("A1:E1").Value = Array("sheet", "Task", "Type", "Key Patient", "Key Doctor")
    For Each sh In Sheets
    With sh
    If .Name <> "Consolidated" Then
    Rng = .Cells(Rows.Count, 1).End(xlUp).Row - 1
    If Rng > 0 Then
    Sheets("Consolidated").Cells(Rows.Count, 1).End(xlUp)(2).Resize(Rng) = .Name
    Sheets("Consolidated").Cells(Rows.Count, 2).End(xlUp)(2).Resize(Rng, 4) = .Range("A2").Resize(Rng, 4).Value
    End If
    End If
    End With
    Next
    .Columns("A:Z").EntireColumn.AutoFit
    End With
    End Sub

    I got this macro from

    http://www.excelforum.com/excel-prog...68#post3286568

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro to combine specific sheets only.

    indianhp,
    You need to wrap your code in code tags. You need to edit the above code, highlight the entire text , then click#.
    Once you have done it, we can reply to your question.

+ 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: 01-27-2013, 07:23 PM
  2. [SOLVED] Macro to combine specific sheets into master sheet
    By JakubPrchal in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-16-2012, 08:34 AM
  3. Macro to combine data from 4 specific sheets into 1
    By kempezzzz in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-06-2012, 11:55 AM
  4. Macro to Combine Sheets
    By Phl1331 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-22-2007, 01:07 PM
  5. Macro - Combine/Insert Sheets
    By dugong in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-08-2007, 07:41 AM

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