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

Поделиться
HTML-код
  • Опубликовано: 18 июн 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
    -----------------------------------------------------------------------------------------------------------

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

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

    But I have no Developer option

    • @Accountingpro_solution
      @Accountingpro_solution  Месяц назад +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 👍