Combine data from multiple sheets into one sheet of the same Excel |

Поделиться
HTML-код
  • Опубликовано: 8 сен 2024
  • Using this VBA code you can combine data from multiple sheets into one sheet : -
    ----------------------------------------------------------------------
    Sub CopySelectedSheetsToActiveSheet()
    Dim ws As Worksheet
    Dim destRange As Range
    Dim srcRange As Range
    ' Set the destination range (where you want to paste the data)
    Set destRange = ActiveSheet.Range("A1")
    ' Loop through each selected sheet
    For Each ws In ActiveWindow.SelectedSheets
    ' Set the source range (the data you want to copy)
    Set srcRange = ws.UsedRange
    ' Copy the data from the source range to the destination range
    srcRange.Copy destRange
    ' Move the destination range down for the next sheet's data
    Set destRange = destRange.Offset(srcRange.Rows.Count)
    Next ws
    End Sub
    -----------------------------------------------------------------------------------------------------------

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

  • @mostainbillah
    @mostainbillah 7 дней назад

    Dear sir,
    Need a Tutorial to get Specific range Data from multiple select file to Active Sheet ,
    I have seen Many kinds of Video tutorials From your channel ,But i haven't Found As a Tutorial .
    I Have a need : get Specific range Data as a Range (A29:D29) to Active Sheet From All selected Workbooks . And Past Active Sheet ,Destination Range (A29:D29) .xldown
    Please help To get Tutorial or Code.
    Please see my Request.
    Best Regards
    Mostain
    Bangladesh

    • @Accountingpro_solution
      @Accountingpro_solution  7 дней назад +1

      Using this VBA code you can combine data from multiple sheets into one sheet : -
      ----------------------------------------------------------------------
      Sub CopySelectedSheetsToActiveSheet()
      Dim ws As Worksheet
      Dim destRange As Range
      Dim srcRange As Range
      ' Set the destination range (where you want to paste the data)
      Set destRange = ActiveSheet.Range("A1")
      ' Loop through each selected sheet
      For Each ws In ActiveWindow.SelectedSheets
      ' Set the source range (the data you want to copy)
      Set srcRange = ws.UsedRange
      ' Copy the data from the source range to the destination range
      srcRange.Copy destRange
      ' Move the destination range down for the next sheet's data
      Set destRange = destRange.Offset(srcRange.Rows.Count)
      Next ws
      End Sub
      -----------------------------------------------------------------------------------------------------------
      I hope this code will help you, or else text like this I'll send another version of the video for you !!
      🤝

  • @rajnarayanan2380
    @rajnarayanan2380 2 месяца назад +2

    But I have no Developer option

    • @Accountingpro_solution
      @Accountingpro_solution  2 месяца назад +1

      Okay, now you can use macros in VIEW -> MACROS -> 'type new' -> CREATE
      If it's not clear enough, text back
      I'll share video in this regards 👍

  • @Prabu1987-o4k
    @Prabu1987-o4k 27 дней назад

    Vb code bro?

    • @Accountingpro_solution
      @Accountingpro_solution  26 дней назад

      In the description

    • @Accountingpro_solution
      @Accountingpro_solution  26 дней назад

      Sub CopySelectedSheetsToActiveSheet()
      Dim ws As Worksheet
      Dim destRange As Range
      Dim srcRange As Range
      ' Set the destination range (where you want to paste the data)
      Set destRange = ActiveSheet.Range("A1")
      ' Loop through each selected sheet
      For Each ws In ActiveWindow.SelectedSheets
      ' Set the source range (the data you want to copy)
      Set srcRange = ws.UsedRange
      ' Copy the data from the source range to the destination range
      srcRange.Copy destRange
      ' Move the destination range down for the next sheet's data
      Set destRange = destRange.Offset(srcRange.Rows.Count)
      Next ws
      End Sub

    • @Prabu1987-o4k
      @Prabu1987-o4k 25 дней назад

      @@Accountingpro_solution Thanks