Transfer data from multiple worksheets to a summary

dtsphil

New Member
Joined
Jul 14, 2021
Messages
7
Office Version
  1. 365
Platform
  1. Windows
Good morning,

Have a review task to perform and I have created a worksheet template and a summary sheet. I have a macro that allows me to duplicate the worksheet as many times as I want. Once I have completed each worksheet, data is held in cells A93:F93. What I am looking for is a macro that transfers these values into the summary sheet cells D8:I8. So, the first worksheet values in A93:F93 will be transferred to cells D8:I8 in the summary sheet. The second worksheet values from A93:F93 need to go to the summary sheet D8:I8, but because the cells already have values, I need the macro to recognize that and offset to cells D9:I9....and so on and so on for the remaining worksheets. Thanks to all for reviewing this post.
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Try the following.
Change in the macro "Summary" by the name of your sheet.

Add in this line of the macro the sheets that should not be considered.
Case "Summary", "Sheet1"


VBA Code:
Sub Transfer_data()
  Dim sh1 As Worksheet, sh As Worksheet
  Dim i As Long
  
  Set sh1 = Sheets("Summary") 'Sheet name "Summary"
  i = 8
  sh1.Range("D8:I" & Rows.Count).ClearContents
  For Each sh In Sheets
    Select Case sh.Name
      Case "Summary", "Sheet1"  'Add here the sheets that should NOT be considered
      Case Else
        If WorksheetFunction.CountA(sh.Range("A93:F93")) > 0 Then
          sh1.Range("D" & i & ":I" & i).Value = sh.Range("A93:F93").Value
          i = i + 1
        End If
    End Select
  Next
End Sub
 
Upvote 0
Try the following.
Change in the macro "Summary" by the name of your sheet.

Add in this line of the macro the sheets that should not be considered.
Case "Summary", "Sheet1"


VBA Code:
Sub Transfer_data()
  Dim sh1 As Worksheet, sh As Worksheet
  Dim i As Long
  
  Set sh1 = Sheets("Summary") 'Sheet name "Summary"
  i = 8
  sh1.Range("D8:I" & Rows.Count).ClearContents
  For Each sh In Sheets
    Select Case sh.Name
      Case "Summary", "Sheet1"  'Add here the sheets that should NOT be considered
      Case Else
        If WorksheetFunction.CountA(sh.Range("A93:F93")) > 0 Then
          sh1.Range("D" & i & ":I" & i).Value = sh.Range("A93:F93").Value
          i = i + 1
        End If
    End Select
  Next
End Sub


Thanks so much. I have spend so much time trying to learn and figure that out.......it works like a charm. This will save me so much time!!!!!!
 
Upvote 0
Im glad to help you, thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,002
Messages
6,122,652
Members
449,092
Latest member
peppernaut

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top