• 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.

worksheet from various workbooks into one excel

baskar5353

New Member
Hi,

i need a help we using 3 excel with many sheets.
i need one new excel with 3sheet from this 3 excel

for an example:
3 Excel name as A,B,C
Excel A has (sheet1,sheet2,sheet3,sheet3.......)
Excel B has (sheet1,sheet2,sheet3,sheet3.......)
Excel C has (sheet1,sheet2,sheet3,sheet3.......)

I want in new excel sheet1 as (from excelA sheet2)sheet2 as (from excel B sheet 1) sheet3 as (from excel C sheet 3)
 
Check this..

Code:
Option Explicit

Sub getWS()
Dim myPath As String, owb As Workbook, newwb As Workbook
Dim wb As Integer, wbarray As Variant
Application.DisplayAlerts = False

myPath = "C:\Users\dEEPAK\Desktop\test\" 'change
wbarray = Array("A", "B", "C") 'change

Set newwb = Workbooks.Add
With newwb
    .Sheets(Array("Sheet1", "Sheet2")).Delete
    .Sheets("Sheet3").Name = "test"
   
For wb = LBound(wbarray) To UBound(wbarray)
    Set owb = Workbooks.Open(myPath & wbarray(wb))
      Sheets("Sheet" & wb + 1).Copy After:=.Sheets(.Sheets.Count)
    owb.Close False
Next

    .Sheets("Sheet3").Delete
End With

Application.DisplayAlerts = True
End Sub
 
when i run it was opening all workbook, i need only 3sheets in one new excel as separate separate sheet
Sheets("Sheet" & wb + 1).Copy After:=.Sheets(.Sheets.Count) showing error in this line
 
This question is asked time and time again, have you tried to help yourself by doing a search
 
when i run it was opening all workbook, i need only 3sheets in one new excel as separate separate sheet
Sheets("Sheet" & wb + 1).Copy After:=.Sheets(.Sheets.Count) showing error in this line
Hi Deepak,

when i run this code it was opening all work book i need only specified sheet only open can u help me
 
Pls share the sample workbooks with their proper named
Pls share the sample workbooks with their proper named
i have attached my file

1.Distribution (excel name) in that sheets name(Distribution ,Review,sheet3)
2.Growth(excel name) in that sheets name(Category,Objective,sheet3)
3.Plan(excel name) in that sheets name(plan,Read me,Bp,Dp)
in that i need only 3 sheet with new excel as
In new excel i need as sheet1 as(Review,from excel Distribution ) sheet2 as (Objective, from Growth) sheet3 as(Read me from excel Read me)
i need this each sheets as separately with in one excel
in new excel i need these sheets
 

Attachments

  • Distribution.xlsx
    114.5 KB · Views: 0
  • Growth.xlsx
    39 KB · Views: 0
  • plan.xlsx
    57.7 KB · Views: 0
Back
Top