Macro to combine data from Multiple Excel Worksheets

Поділитися
Вставка
  • Опубліковано 25 сер 2024
  • Excel Macro to combine data from Multiple Worksheets of a Workbook is explained in this video.
    🍐Join my online course on Excel Tables
    www.udemy.com/...
    🍓Download my free eBook on Excel Macros
    eepurl.com/gpT0RD
    🍇Check these Books on Excel
    xlncad.com/exc...
    🍉Read my articles on Excel
    xlncad.com/
    🍏Playlist for Shorts on Excel
    • Short videos on Excel ...
    VBA code to combine data from Multiple Worksheets of an Excel Workbook
    Sub Combine_WorkSheets()
    Dim sRow, sCol, lRow, lCol As Long
    Dim hdrs As Range
    For Each Sheet In ActiveWorkbook.Worksheets
    If Sheet.Name = "Master" Then
    Application.DisplayAlerts = False
    Worksheets("Master").Delete
    Application.DisplayAlerts = True
    End If
    Next Sheet
    Sheets.Add.Name = "Master"
    Set mtr = Worksheets("Master")
    Set wb = ActiveWorkbook
    Set hdrs = Application.InputBox("Select the headers", Type:=8)
    hdrs.Copy mtr.Range("A1")
    sRow = hdrs.Row + 1
    sCol = hdrs.Column
    Debug.Print sRow, sCol
    For Each ws In wb.Worksheets
    If ws.Name (not equal to, replace with angled brackets) "Master" Then
    ws.Activate
    lRow = Cells(Rows.Count, sCol).End(xlUp).Row
    lCol = Cells(sRow, Columns.Count).End(xlToLeft).Column
    Range(Cells(sRow, sCol), Cells(lRow, lCol)).Copy _
    mtr.Range("A" & mtr.Cells(Rows.Count, 1).End(xlUp).Row + 1)
    End If
    Next ws
    Worksheets("Master").Activate
    ActiveWindow.Zoom = 115
    End Sub
    #excelmacro #vbatutorial #combineworksheets

КОМЕНТАРІ • 5

  • @serdargn3873
    @serdargn3873 Місяць тому +1

    Hello. Respect man.

  • @MohAboAbdo
    @MohAboAbdo 6 місяців тому

    Thank you so much

  • @cadphilpo1564
    @cadphilpo1564 5 місяців тому

    thanks, you are a hero. If you could please share a macro code where you want to copy the autosum from a Column to a different worksheet

  • @laisonkc
    @laisonkc 11 місяців тому

    Can you share the VBA code mentioned in the video, I am unable to copy the same from the description box. Thank you very much for the efforts to create the code. This video will help me more , presently I am doing as mannual mode.

  • @Arun.123.
    @Arun.123. 10 місяців тому

    How to connect 2sheets in excel with if conditional format like if sheet1B118=20-10-2023,Sheet2C118=Sheet1B17.kindly reply.