Consolidate Multiple Files based on Column Headers in VBA

Поделиться
HTML-код
  • Опубликовано: 17 июл 2022
  • #renamemultiplefoldersatonce,#Getallfoldername,#renamefolder
    In this video, you will learn how to consolidate multiple files based on Column Header and browse folders in Excel VBA.
    Download Practice File:
    drive.google.com/drive/folder...
    EXCEL DASHBOARD PLAYLIST:
     EXCEL DASHBOARD: • EXCEL DASHBOARD
    EXCEL VBA PLAYLIST:
     VBA SERIES ZERO TO PRO: • The A - Z Of Vba Intro...
    VBA Brain Breaker
     VBA Brain Breaker: • VBA Brain Breaker
    ADVANCED ARRAY SERIES PLAYLIST:
     MASTERING IN ARRAY FORMULAS: • How to use Array in ex...
    ADVANCED EXCEL PLAYLIST:
     SIMPLE TO ADVANCED EXCEL SERIES IN HINDI: • How to get the sum of ...
    MIS INTERVIEW QUESTIONS & ANSWERS PLAYLIST:
     Excel Interview Question & Answer | MIS Interview #1: • Excel Interview Questi...
     MIS Interview Question and Answer #2: • MIS Interview Success:...
     MIS Interview Question and Answer #3: • Cracking the MIS Inter...
     Frequently Asked Interview Questions | You should Know: • Frequently Asked Inter...
    ACCESS AUTOMATION PLAYLIST:
     Import Data from Access Database to Excel | Access Automation: • Import Data from Acces...
     Populate Access DB Data into ListBox & Combobox in VBA: • Populate Access DB Dat...
     Import Access DB Data into Excel with multiple conditions: • Import Access db Data ...
    #Consolidatedatabasedonheaders
    #ConsolidateMultiplefilebasedonheader
    #excelvba
    #vbaconsolidate

Комментарии • 96

  • @mondaygame9605
    @mondaygame9605 Год назад +1

    Wow learnt something new here. Great videi

  • @llytalks3212
    @llytalks3212 Год назад +1

    Thanks for sharing your knowledge

  • @soothingrelaxingnature299
    @soothingrelaxingnature299 Год назад +1

    Very well explained

  • @mohammadumer990
    @mohammadumer990 Год назад +3

    what a wonderful way of explaining things..amazing videio

  • @jsentertainment347
    @jsentertainment347 Год назад +1

    Really your video very useful us

  • @elastigirl1232
    @elastigirl1232 Год назад +1

    This is such helpful information

  • @fridayy1498
    @fridayy1498 Год назад +1

    Very informative video

  • @saweraskincaretips342
    @saweraskincaretips342 Год назад +2

    Thank u for sharing these kind of informational videos always so helpful stay blessed

  • @manharkaur3271
    @manharkaur3271 Год назад +1

    Good way of learning

  • @eshaaleshal2042
    @eshaaleshal2042 Год назад +1

    Wow its really amazing video

  • @aqibkhaan9021
    @aqibkhaan9021 Год назад +1

    Nice sharing Mehandi queen

  • @maryamarshad8547
    @maryamarshad8547 Год назад +1

    What a wonderful video

  • @flaviathuja4022
    @flaviathuja4022 Год назад +1

    Greate video.. well explained

  • @soundeffects3889
    @soundeffects3889 Год назад +2

    You are very knowledgeable and great tutorial in explaining things !!

  • @shellyfullerton
    @shellyfullerton Год назад +1

    Here again to continue with the end

  • @aeriusdee192
    @aeriusdee192 Год назад

    very well explained..thanks for sharing

  • @jyotijoshi3055
    @jyotijoshi3055 Год назад +2

    Nicely explained thanks for sharing with us👍

  • @ahedam
    @ahedam Год назад +1

    Great sharing nice explain

  • @CookingstitchingWithShaheen
    @CookingstitchingWithShaheen Год назад +1

    Nice sharing 👍

  • @jobbatical2645
    @jobbatical2645 Год назад +1

    Great video 👍

  • @Vishumandal1990
    @Vishumandal1990 Год назад +1

    Very good sir

  • @mahamgaming4442
    @mahamgaming4442 Год назад +1

    Great video nice sharing

  • @MohAboAbdo
    @MohAboAbdo 5 месяцев назад +1

    Thank you so much

  • @bremoore3131
    @bremoore3131 Год назад +1

    This is so helpful

  • @Nature-fg7lx
    @Nature-fg7lx Год назад +1

    Nicely explained thanks for sharing 👌
    Cookfood diary

  • @elastigirl1232
    @elastigirl1232 Год назад +1

    Wow this is awesome

  • @rubfacts1283
    @rubfacts1283 Год назад +1

    Great sharing like always, keep it up!

  • @desikitchenstyles4478
    @desikitchenstyles4478 Год назад +1

    Nice sharing

  • @rabiakhan1941
    @rabiakhan1941 Год назад +1

    Very informative video ushared thnku so much

  • @jsentertainment347
    @jsentertainment347 Год назад +1

    Excellent Wow great information 👍

  • @llytalks3212
    @llytalks3212 Год назад +1

    So great I came here twice

  • @saweraskincaretips342
    @saweraskincaretips342 Год назад +1

    Amazing informative videos thank u so much for sharing

  • @meandyoulove2220
    @meandyoulove2220 Год назад +1

    Very good

  • @hennabysawera8268
    @hennabysawera8268 Год назад +1

    Amazing good job

  • @ramprasadmarmat8422
    @ramprasadmarmat8422 Месяц назад +1

    Useful bna coding sir

  • @summerkhan8906
    @summerkhan8906 Год назад +1

    Great sharing

  • @maryamunnisa6021
    @maryamunnisa6021 Год назад +1

    What a wonder video

  • @jaat__---
    @jaat__--- Год назад +1

    Awesome!!

  • @yvandellvega4997
    @yvandellvega4997 Год назад +1

    Great sharing, keep it up!

  • @govindkumarsodani3290
    @govindkumarsodani3290 Год назад +1

    best useful

  • @mehndiiartist3536
    @mehndiiartist3536 Год назад +1

    V Informative thanks for Sharing

  • @funtimes5290
    @funtimes5290 Год назад

    Great explanation

  • @sandramanoel3558
    @sandramanoel3558 2 года назад +1

    Great!

  • @nmbspltd5766
    @nmbspltd5766 Год назад +1

    Excellent. Appreciate the manner in which you explained a complex process. Watched it 6 times today and was finally able to apply this in a real life scenario. Thank you so much.

  • @genmacaya4240
    @genmacaya4240 Год назад +1

    Well explained! Thank you

  • @vacaymode3458
    @vacaymode3458 Год назад +1

    Well explained instructions

  • @pcmommy2921
    @pcmommy2921 Год назад

    Very informative. Thanks for sharing!

  • @rooskimama
    @rooskimama Год назад +1

    Great information shared

  • @sandramanoel1135
    @sandramanoel1135 Год назад +1

    🤗🤗🤗🤗🤗 Nice

  • @shellyfullerton
    @shellyfullerton Год назад +1

    Amazing

  • @sodacan5348
    @sodacan5348 Год назад +1

    Wow this was really good !!

  • @purple7413
    @purple7413 Год назад +1

    Love it!

  • @sandrinhamanoel4766
    @sandrinhamanoel4766 Год назад +1

    Muito bom seu vídeo 🤗🤗🤗🤗

  • @shellyfullerton
    @shellyfullerton Год назад +1

    👍

  • @sandramanoel2159
    @sandramanoel2159 2 года назад +1

    Nice!

  • @sheelugupta2190
    @sheelugupta2190 Год назад +1

    great explanation 👍

  • @cancer483
    @cancer483 Год назад +1

    Great content ❤️

  • @sparklst3f877
    @sparklst3f877 Год назад +1

    Thank you for sharing this. When I worked in a worksheet range was OK. But when I converted my worksheet to a table format, it didn't work anymore. I need in table format to allow nice slicer (Auto filter feature in Excel) to work in different sheet tab. Can you help me Sir? Thanks in advance.

    • @levelupexcelskill
      @levelupexcelskill  Год назад

      We would be delighted to assist you. If possible, kindly send me some sample files at levelupexcelskill@gmail.com. I'll automate this.

  • @lalitajoshi1816
    @lalitajoshi1816 Год назад +1

    Very nic
    K m beauty

  • @usharaniyatish3879
    @usharaniyatish3879 Год назад +1

    how can we copy using input box value -- autofilter
    from mutlple WB to paste master workbook

    • @levelupexcelskill
      @levelupexcelskill  Год назад

      You can use application.inputbox("Select range", Type:=8)
      You can share a sample file if you want to automate

  • @Moeezshem1
    @Moeezshem1 6 месяцев назад +1

    Please help to understand multiple file and multiple sheet based on Column Headers?

    • @levelupexcelskill
      @levelupexcelskill  6 месяцев назад +1

      Please find the below code for your reference
      Sub ConsolidateFiles()
      Dim folderPath As String
      Dim targetWorkbook As Workbook
      Dim ws As Worksheet
      Dim fileName As String
      Dim sourceWorkbook As Workbook
      Dim sourceSheet As Worksheet
      Dim lastRow As Long
      Dim headerColumnIndex As Variant
      ' Set the target workbook (where you want to consolidate the data)
      Set targetWorkbook = Workbooks.Add
      ' Specify the folder path containing the Excel files to consolidate
      folderPath = "C:\Path\To\Your\Folder\"
      ' Loop through each file in the folder
      fileName = Dir(folderPath & "*.xlsx")
      Do While fileName ""
      ' Open the source workbook
      Set sourceWorkbook = Workbooks.Open(folderPath & fileName)
      ' Loop through each sheet in the source workbook
      For Each sourceSheet In sourceWorkbook.Sheets
      ' Find the column index of the specified header
      headerColumnIndex = Application.Match("YourColumnHeader", sourceSheet.Rows(1), 0)
      ' Check if the header exists (headerColumnIndex is not an error)
      If Not IsError(headerColumnIndex) Then
      ' Find the last row in the target sheet
      Set ws = targetWorkbook.Sheets.Add
      lastRow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row + 1
      ' Copy data from the source sheet to the target sheet
      sourceSheet.UsedRange.Copy ws.Cells(lastRow, 1)
      End If
      Next sourceSheet
      ' Close the source workbook without saving changes
      sourceWorkbook.Close False
      ' Get the next file in the folder
      fileName = Dir
      Loop
      End Sub

  • @chandrashekharprajapati9451
    @chandrashekharprajapati9451 Год назад +1

    Thanks for this kind of videos. It's very helpful session, it but I have few query please assist me how can I contact you.

    • @levelupexcelskill
      @levelupexcelskill  Год назад

      Email me at levelupexcelskill@gmail.com if you wish to get in touch.

  • @niteshyadav217
    @niteshyadav217 Год назад +1

    Thanks for sharing vba coding for consol files, but getting debug error on 'set ws =wb.Activesheet'

    • @levelupexcelskill
      @levelupexcelskill  Год назад

      Please run in a breakpoint mode then check why it is showing. Any doubts please send me your code or sample file.

    • @niteshyadav217
      @niteshyadav217 Год назад

      Thanks,can we share your email id to get better understanding

    • @levelupexcelskill
      @levelupexcelskill  Год назад

      @@niteshyadav217 Ayush75031@gmail.com

  • @abhishekawari919
    @abhishekawari919 Год назад +1

    I have an problem that having inconsistence header in multiple woeksheets and thoes header we have map then consolidate. Can you please guide on this problem statement

    • @levelupexcelskill
      @levelupexcelskill  Год назад

      Yes, please share the same file with us on our email id levelupexcelskill@gmail.com

    • @abhishekawari919
      @abhishekawari919 Год назад +1

      @@levelupexcelskill i have shared the file over an above mail

    • @levelupexcelskill
      @levelupexcelskill  Год назад

      @@abhishekawari919 shared please check

  • @svashok4245
    @svashok4245 11 месяцев назад +1

    If first row blank macro does not work

  • @payeldey870
    @payeldey870 Год назад +1

    I have a question. Can I apply this to when I am looking for to copy paste data into one sheet, from a ‘Summary’ sheet of 67 different workbooks? Would that copy paste data from different workbooks one after the other or would that overwrite the previous data?

    • @levelupexcelskill
      @levelupexcelskill  Год назад

      Yes, it will work, but you will need to change some lines of code. For example, I've mentioned the sheet name as Report sheet and my data starts in row 6. This deletes the existing old data in Report sheets and consolidates multiple workbooks. If you want your data to remain the same, you must delete this code.
      code like: SHT.Range("C6:J1048576").Clear
      This will help you to consolidate multiple workbooks if some code is modified according to your workbook and then run it
      Sub CONSOLIDATEFILE()
      Dim SHT As Worksheet
      Dim PATH As String
      Dim FILENAME As String
      Dim WB As Workbook
      Dim WS As Worksheet
      Dim lR As Long
      Dim CL As Long
      Dim NEWROW As Long
      Dim I As Long
      Dim MT As Long
      Set SHT = ThisWorkbook.Worksheets("Report") 'Change sheet name as per your sheet
      SHT.Range("C6:J1048576").Clear 'if you wish to keep old data then delete this code from here
      PATH = SHT.Range("E2")
      FILENAME = Dir(PATH & "*.XL*")
      Do While FILENAME ""
      Set WB = Workbooks.Open(PATH & FILENAME, False, True)
      Set WS = WB.ActiveSheet
      lR = WS.Range("A1048576").End(xlUp).Row
      NEWROW = SHT.Range("C1048576").End(xlUp).Row + 1
      CL = SHT.Range("XFD5").End(xlToLeft).Column
      For I = 3 To CL
      If Not IsError(Application.Match(SHT.Cells(5, I), WS.Range("1:1"), 0)) Then
      MT = Application.Match(SHT.Cells(5, I), WS.Range("1:1"), 0)
      WB.Activate
      WS.Activate
      WS.Range(WS.Cells(2, MT), WS.Cells(lR, MT)).Copy
      ThisWorkbook.Activate
      SHT.Activate
      SHT.Cells(NEWROW, I).PasteSpecial xlPasteValuesAndNumberFormats
      Application.CutCopyMode = False
      End If
      Next
      Application.DisplayAlerts = False
      WB.Close
      Application.DisplayAlerts = True
      FILENAME = Dir
      Loop
      SHT.Range("C6", SHT.Range("J6").End(xlDown)).Borders.LineStyle = xlContinuous
      SHT.Range("C6", SHT.Range("J6").End(xlDown)).Borders.Color = RGB(217, 217, 217)
      SHT.Range("C6", SHT.Range("J6").End(xlDown)).HorizontalAlignment = xlCenter
      SHT.Range("C6", SHT.Range("J6").End(xlDown)).VerticalAlignment = xlCenter
      End Sub

    • @payeldey870
      @payeldey870 Год назад +1

      Thank you for your response, and appreciate you taking time out of your busy schedule and writing the code for me! I am very new to vba, hence the confusion. I wouldn’t be able to tell the difference much. Can I explain the situation here, and ask if the code that you have provided would work in my case or not?
      I have 67 separate workbooks. Each workbook has 4 worksheets, out of which I just want to copy data from the sheet named ‘Summary’, to another separate workbook. The data from those 67 ‘Summary’ sheets should copy one after the other without deleting the previous workbook’s Summary’ sheet data. Would the code that you’ve provided work in this situation? Thank you in advance and your response would be highly appreciated!

    • @levelupexcelskill
      @levelupexcelskill  Год назад

      @@payeldey870 Yes, it will work, but we need to add a little additional code. Please provide me with a sample file so I can create a macro and describe each line of code. Levelupexcelskill@gmail.com is my email address

    • @payeldey870
      @payeldey870 Год назад +1

      Thank you Sir. I sent you the sample random data files to your above mentioned email address for further guidance. Please let me know if that’s possible.

    • @levelupexcelskill
      @levelupexcelskill  Год назад

      @@payeldey870 Sent Template file

  • @rajadurai336
    @rajadurai336 5 месяцев назад +1

    how to use .csv FILE

  • @jsentertainment347
    @jsentertainment347 Год назад +1

    How to collate multiple sheets one file using this coding.

    • @levelupexcelskill
      @levelupexcelskill  Год назад +1

      Please share your email address because you will need to add some additional lines and loops to get data. I'll email the information to you.

  • @ashoksalve4154
    @ashoksalve4154 11 месяцев назад +1

    sir, how to get file name in cell

    • @levelupexcelskill
      @levelupexcelskill  11 месяцев назад

      You can simply add code wb.name below the loop

  • @niteshyadav217
    @niteshyadav217 Год назад +1

    Can u share vba code?

    • @levelupexcelskill
      @levelupexcelskill  Год назад

      @Nitesh Yadav, you can download the file from the description box that I mentioned.

  • @matildaskidsshow7997
    @matildaskidsshow7997 Год назад +1

    Very well explained

  • @noahark338
    @noahark338 Год назад +1

    Great video 👍

  • @wendellvega792
    @wendellvega792 Год назад +1

    Great sharing, keep it up!

  • @darishkkhan8196
    @darishkkhan8196 Год назад

    Very informative video