Combine data from multiple sheets into one sheet of the same Excel |
Вставка
- Опубліковано 17 вер 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
-----------------------------------------------------------------------------------------------------------
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
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 !!
🤝
But I have no Developer option
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 👍
Vb code bro?
In the description
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
@@Accountingpro_solution Thanks